You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to create a multi-partite graph not fully connected between the layers. It is created by subtracting a probability mass function from layer to layer and therefore, the nodes carry the type tuple[int,int] (layer number, display value). I expect the nodes in the layers / partitions to be either ascending or descending but this is not the case:
Expected behavior
I expect to be able to take influence on how the nodes are rendered by specifying the order in the partitions argument to Graph(). This is not the case.
I found a solution that works around this behavior:
After digging into networkx, I found out that in networkx.utils.misc.groups the ordering is lost. To avoid calling this tool, one can pass a dictionary that maps the layer number to a sorted list of its nodes:
fori, pinenumerate(partitions):
subset_key[i] =pgraph=Graph(
vertices,
edges,
# labels=True,labels=labels,
layout="partite",
layout_config={"subset_key": subset_key}, # <----- This line suppress a shuffling of nodespartitions=partitions,
)
I have the feeling, that this is closer to the expected behavior and should be considered to be added to Graph._partite_layout.
The text was updated successfully, but these errors were encountered:
Description of bug / unexpected behavior
I want to create a multi-partite graph not fully connected between the layers. It is created by subtracting a probability mass function from layer to layer and therefore, the nodes carry the type
tuple[int,int]
(layer number, display value). I expect the nodes in the layers / partitions to be either ascending or descending but this is not the case:Expected behavior
I expect to be able to take influence on how the nodes are rendered by specifying the order in the
partitions
argument toGraph()
. This is not the case.How to reproduce the issue
Code for reproducing the problem
Additional comments
I found a solution that works around this behavior:
After digging into networkx, I found out that in
networkx.utils.misc.groups
the ordering is lost. To avoid calling this tool, one can pass a dictionary that maps the layer number to a sorted list of its nodes:I have the feeling, that this is closer to the expected behavior and should be considered to be added to
Graph._partite_layout
.The text was updated successfully, but these errors were encountered: