Skip to content

Rewrite graph to use a map data structure#78

Open
jmatth wants to merge 3 commits intotchayen:masterfrom
jmatth:graph-data-structure
Open

Rewrite graph to use a map data structure#78
jmatth wants to merge 3 commits intotchayen:masterfrom
jmatth:graph-data-structure

Conversation

@jmatth
Copy link
Contributor

@jmatth jmatth commented Dec 11, 2020

This should address #38. Doesn't add any functionality on its own, but I'm looking into adding a local graph view (only show the current file and any nodes connected to it) and this is a prerequisite for that to run with any efficiency.

Copy link
Owner

@tchayen tchayen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for this very solid work. Especially appreciate tests.

Looks like we have now two PRs aiming to change internal graph representation – #50 and this one. Although progress there stagnated and became partially irrelevant as for example Foam moved on from depending on this extension.

Local graph view is definitely something worth considering. Looking forward to merging this PR, need to give it more thought first.

Adding some comments with requests for changes.

import { assert } from 'chai';
import { Graph, Node } from '../../types';

describe('Graph', function() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Prettier as in other files of the repository.

Comment on lines -6 to +170
export type Node = {
export type D3Node = {
id: string;
path: string;
label: string;
};

export type Graph = {
nodes: Node[];
edges: Edge[];
export type D3Edge = {
source: string;
target: string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are those two changes reflected in other places? Maybe it's dead code and might as well be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These types are still used in the return from Graph.toD3Graph(), which is what is called to get the payload that is sent to the D3 webview.

@jmatth jmatth force-pushed the graph-data-structure branch from f9a386c to 448514b Compare December 30, 2020 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants