Fixing node and edge numbers in graphs containing subgraphs. #22
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.
Number of nodes doesn't count those in subgraphs #15
Summary
Fixed the issue above and added tests for this property.
I also fixed any existing tests which were broken by the change.
The solution works by summing the total number of edges in a graphs as well as any of it's subgraphs.
Behavioural Oddities
There is one oddity this implementation #results in.
A subgraph can contain edges between nodes not contained within it or it's children.
This means that there can be 20 edges within a subgraph but no nodes so when calling
ViewString
the output may be somewhat surprising (ie.<graph test with 0 nodes and 20 edges>
).This however would logically follow from the code which created the graph as well as the
DOT
code outputted.Let me know if you think there is a better alternative behaviour.