-
Notifications
You must be signed in to change notification settings - Fork 139
Caching Adjacency Matrix for faster edge lookup #344
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c69ccf7
Added changes to save nodes in Dijkstra shortest path. Modified tests.
guru2396 8fca1dc
Merge branch 'ZigRazor:master' into master
guru2396 d4aa31d
Merge branch 'ZigRazor:master' into master
guru2396 62f0597
Caching adjacency matrix for faster edge lookup
guru2396 f97818c
Merge branch 'master' of https://github.com/guru2396/CXXGraph
guru2396 0454d53
changing return type of getCacheAdjMatrix(), using alias for shared_ptr
guru2396 38e47d7
using alias for shared_ptr, removing unused vars
guru2396 842d796
Merge branch 'ZigRazor:master' into master
guru2396 6b85303
added more tests for findEdge()
guru2396 72b124e
added more tests for findEdge()
guru2396 d3815b9
renaming function, adding spaces
guru2396 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,6 +105,33 @@ TEST(GraphTest, GetNodeSet_2) { | |
| }) != nodeSet.end()); | ||
| } | ||
|
|
||
| TEST(GraphTest, FindEdge_Test) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add spacing in logical places between lines in this test. It's hard to read
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Please review. |
||
| CXXGraph::Node<int> node1("1", 1); | ||
| CXXGraph::Node<int> node2("2", 2); | ||
| CXXGraph::Node<int> node3("3", 3); | ||
| CXXGraph::Node<int> node4("4", 2); | ||
| CXXGraph::Node<int> node5("5", 3); | ||
| CXXGraph::UndirectedEdge<int> edge(1, node1, node2); | ||
| CXXGraph::UndirectedEdge<int> edge2(2, node2, node3); | ||
| CXXGraph::T_EdgeSet<int> edgeSet; | ||
| edgeSet.insert(make_shared<CXXGraph::UndirectedEdge<int>>(edge)); | ||
| edgeSet.insert(make_shared<CXXGraph::UndirectedEdge<int>>(edge2)); | ||
| CXXGraph::Graph<int> graph(edgeSet); | ||
| unsigned long long edgeId = 0; | ||
| ASSERT_TRUE(graph.findEdge(&node1,&node2,edgeId)); | ||
| CXXGraph::UndirectedEdge<int> edge3(3, node1, node3); | ||
| graph.addEdge(make_shared<CXXGraph::UndirectedEdge<int>>(edge3)); | ||
| ASSERT_TRUE(graph.findEdge(&node1,&node3,edgeId)); | ||
| ASSERT_TRUE(graph.findEdge(&node3,&node1,edgeId)); | ||
| CXXGraph::DirectedEdge<int> edge4(4, node1, node5); | ||
| graph.addEdge(make_shared<CXXGraph::DirectedEdge<int>>(edge4)); | ||
| ASSERT_TRUE(graph.findEdge(&node1,&node5,edgeId)); | ||
| ASSERT_FALSE(graph.findEdge(&node5,&node1,edgeId)); | ||
| graph.removeEdge(2); | ||
| ASSERT_FALSE(graph.findEdge(&node2,&node3,edgeId)); | ||
| ASSERT_FALSE(graph.findEdge(&node3,&node2,edgeId)); | ||
| } | ||
|
|
||
| TEST(GraphTest, RawAddEdge_1) { | ||
| CXXGraph::Node<int> n1("a", 1); | ||
| CXXGraph::Node<int> n2("b", 1); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.