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

Add support for labelled edges #3

Open
Smuzzy-waiii opened this issue Oct 15, 2024 · 0 comments
Open

Add support for labelled edges #3

Smuzzy-waiii opened this issue Oct 15, 2024 · 0 comments
Labels
Bounty: 1200 enhancement New feature or request

Comments

@Smuzzy-waiii
Copy link
Contributor

Smuzzy-waiii commented Oct 15, 2024

Currently the graph has unlabelled edges. The task is to add support for labelled edges.

The way the edges are currently stored as KV pairs in badger are as follows:
The src node is the key and the value is a list of destination nodes which are stored as map[string]bool in the codebase where the string is the dest node and the bool does not really mean anything. This map[string]bool is serialized to []byte using gob and is Set as the Value in badger. Please refer to the Internals section of the CONTRIBUTING.md for more details on how the internal storage representation works

Modify this to use map[string]map[string]bool where the first string is the label and the map[string]bool succeeding it is the same as before.

The following functions will also need to be modified to account for labels: AddEdge, RemoveEdge, GetEdges, OutEdges, IterAllEdges and basically any other function that got added in the course of hacknight itself except maybe for PickRandomVertex

Have GetEdges, OutEdges and IterAllEdges take in a label and allow support for passing in "" as the wildcard operator to operate on all edges. Consequently you will have to modify AddEdge and RemoveEdge to disallow "" being passed as a label.

Please update the function calls lib_test.go file since you are making breaking changes to the API and write unit tests for testing Labelled Edges

psst, remember to update the usage guide in the README too 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bounty: 1200 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant