Displaying Overlapping Communities for Networks Without Clustering with SBMs
Hi, I am trying to generate plots for communities detected by another algorithm (outside graph-tool). The communities are overlapping and I wanted to display something like nodes with multiple colors (like we have for SBMs). For this I set a new vertex property and assign nodal memberships to it. I assign a matrix which contains one hot vectors for each node's community membership. So the matrix has shape n x g where n is the number of nodes and g is the number of communities. When I use graph_draw like: graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv, edge_gradient=None, output="lesmis-sbm-marginals.svg") where pv is the property map, I get: python3: ../../../../src/cairo-arc.c:189: _cairo_arc_in_direction: Assertion `angle_max >= angle_min' failed. I want to show overlapping clusters with graph-tool, but the clustering hasn't been performed by graph-tool. Any ideas as to how to go about this? Thanks! -- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
You're probably just passing the wrong type to vertex_pie_fractions, but we have no way to know that as we're missing the minimal self-contained example. .~´ On Thu, Oct 5, 2017 at 11:54 AM, isukritgupta <isukritgupta@gmail.com> wrote:
Hi, I am trying to generate plots for communities detected by another algorithm (outside graph-tool). The communities are overlapping and I wanted to display something like nodes with multiple colors (like we have for SBMs). For this I set a new vertex property and assign nodal memberships to it. I assign a matrix which contains one hot vectors for each node's community membership. So the matrix has shape n x g where n is the number of nodes and g is the number of communities. When I use graph_draw like:
graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv, edge_gradient=None, output="lesmis-sbm-marginals.svg")
where pv is the property map, I get: python3: ../../../../src/cairo-arc.c:189: _cairo_arc_in_direction: Assertion `angle_max >= angle_min' failed.
I want to show overlapping clusters with graph-tool, but the clustering hasn't been performed by graph-tool.
Any ideas as to how to go about this?
Thanks!
-- Sent from: http://main-discussion-list-for-the-graph-tool-project. 982480.n3.nabble.com/ _______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
This should reproduce the error: g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() e = g.add_edge(v1, v2) pv1 = g.new_vertex_property("vector<int>"); pv1.set_2d_array(np.zeros((2, 2))) graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv1, edge_gradient=None, output="lesmis-sbm-marginals.svg") -- Sent from: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
On 06.10.2017 02:47, isukritgupta wrote:
This should reproduce the error: g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() e = g.add_edge(v1, v2) pv1 = g.new_vertex_property("vector<int>"); pv1.set_2d_array(np.zeros((2, 2))) graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv1, edge_gradient=None, output="lesmis-sbm-marginals.svg")
Why do you want pies with all zero fractions? What would that accomplish? You should be doing something like: g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() e = g.add_edge(v1, v2) pv1 = g.new_vertex_property("vector<double>", val=(.2, .8)) graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv1) But I agree it should not crash if the input is invalid. I'll fix this behavior. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
So if I want a vertex to have multiple colors (fractions), what should the pv1 look like? Please look at my question description. Thanks, Sukrit On 06-Oct-2017 6:35 PM, "Tiago de Paula Peixoto" <tiago@skewed.de> wrote: On 06.10.2017 02:47, isukritgupta wrote:
This should reproduce the error: g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() e = g.add_edge(v1, v2) pv1 = g.new_vertex_property("vector<int>"); pv1.set_2d_array(np.zeros((2, 2))) graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv1, edge_gradient=None, output="lesmis-sbm-marginals.svg")
Why do you want pies with all zero fractions? What would that accomplish? You should be doing something like: g = Graph() v1 = g.add_vertex() v2 = g.add_vertex() e = g.add_edge(v1, v2) pv1 = g.new_vertex_property("vector<double>", val=(.2, .8)) graph_draw(g, vertex_shape="pie", vertex_pie_fractions=pv1) But I agree it should not crash if the input is invalid. I'll fix this behavior. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de> _______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
On 06.10.2017 11:37, Sukrit Gupta wrote:
So if I want a vertex to have multiple colors (fractions), what should the pv1 look like? Please look at my question description.
I don't know how to make this any clearer. It should contain a value for each fraction: pv[g.vertex(0)] = [.3, .6, .1] # 30% with color 0, 60% with color 1, 10% with color 2 -- Tiago de Paula Peixoto <tiago@skewed.de>
Thanks, Tiago. The issue was the fact that when you added vertices which did not have any clusters associated with them (isolated nodes), there was an error. This behavior should be fixed, if possible. Sukrit ________________ Sukrit Gupta, B.Eng. (CS, PEC, In). C: 0091 856.680.0668 | W: https://sites.google.com/site/sukritsite On Fri, Oct 6, 2017 at 6:44 PM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
On 06.10.2017 11:37, Sukrit Gupta wrote:
So if I want a vertex to have multiple colors (fractions), what should the pv1 look like? Please look at my question description.
I don't know how to make this any clearer. It should contain a value for each fraction:
pv[g.vertex(0)] = [.3, .6, .1] # 30% with color 0, 60% with color 1, 10% with color 2
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
participants (4)
-
Alexandre Hannud Abdo -
isukritgupta -
Sukrit Gupta -
Tiago de Paula Peixoto