Fixed the error about edge_attr dict in cases where edge is defined a… #254
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.
…s (large num, small num) instead of (small num, large num)
Identify the Bug
Issue: #253
Description of the Change
As it is stated in the issue, when edges are not defined like (small number, large number), attribute related to it cannot be found in the edge_attr dictionary. So whenever we try to access a value from that dictionary, we should also check if (large number, small number) version of the edge exists. Not doing this check results in a key error.
Note: In directed graphs, this change does not apply. Therefore, in EdgeCategorical compartment, we also introduce a flag which is True when the graph is directed. This extra check in edge_attr is done when the graph is undirected.
Possible Drawbacks
In my tests, I haven't seen any negative impacts or bugs caused by this change. Directed graphs can be inspected further.
Verification Process
I have tested with different type of networks generated by networkx library (erdos_renyi_graph, watts_strogatz_graph, random_regular_graph, barabasi_albert_graph) as well as a file input. All graphs were undirected. By inspecting the iteration trends, we can observe that it works as intended.
Release Notes
Edge attribute compartments now support undirected edges defined as (large num, small num)