Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite graph to use a map data structure #78

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

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