Removing duplicate graph states
Dear all, I have many different states of the same graph. Every state corresponds to a given set of values on the nodes fixed using 'new_vertex_property.' I want to select unique network states, i.e., I want to remove the duplicate states from the collection. Is there any way in graph-tool to achieve this? If not, what is the solution? Thank you -- Snehal M. Shekatkar Pune India www.snehalshekatkar.com
On 03.12.2017 16:57, Snehal Shekatkar wrote:
I have many different states of the same graph. Every state corresponds to a given set of values on the nodes fixed using 'new_vertex_property.' I want to select unique network states, i.e., I want to remove the duplicate states from the collection. Is there any way in graph-tool to achieve this? If not, what is the solution?
Your question is too vague. Without a specific code example, it is difficult to help you. -- Tiago de Paula Peixoto <tiago@skewed.de>
Consider the following: g = gt.collection.data['karate'] g1 = gt.Graph(g) g2 = gt.Graph(g) g3 = gt.Graph(g) state1 = g1.new_vertex_property('int') state2 = g2.new_vertex_property('int') state3 = g3.new_vertex_property('int') for v in g1.vertices(): state1[v] = 1 for v in state2.vertices(): state2[v] = 1 for v in g3.vertices(): state3[v] = -1 I want something like this: set([g1, g2, g3]) = {g1, g3} because states of g1 and g2 are exactly same for all the vertices but are different from that of g3. Thank you On Sun, Dec 3, 2017 at 9:33 PM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
On 03.12.2017 16:57, Snehal Shekatkar wrote:
I have many different states of the same graph. Every state corresponds to a given set of values on the nodes fixed using 'new_vertex_property.' I want to select unique network states, i.e., I want to remove the duplicate states from the collection. Is there any way in graph-tool to achieve this? If not, what is the solution?
Your question is too vague. Without a specific code example, it is difficult to help you.
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India www.snehalshekatkar.com
On 03.12.2017 17:10, Snehal Shekatkar wrote:
I want something like this: set([g1, g2, g3]) = {g1, g3} because states of g1 and g2 are exactly same for all the vertices but are different from that of g3.
Just do: set([tuple(state1.a), tuple(state2.a), tuple(state3.a)]) (I'm assuming you want to construct a set of the property maps, not graphs.) -- Tiago de Paula Peixoto <tiago@skewed.de>
That works! Thanks a lot. On Sun, Dec 3, 2017 at 9:47 PM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
On 03.12.2017 17:10, Snehal Shekatkar wrote:
I want something like this: set([g1, g2, g3]) = {g1, g3} because states of g1 and g2 are exactly same for all the vertices but are different from that of g3.
Just do:
set([tuple(state1.a), tuple(state2.a), tuple(state3.a)])
(I'm assuming you want to construct a set of the property maps, not graphs.)
-- Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Snehal M. Shekatkar Pune India www.snehalshekatkar.com
participants (2)
-
Snehal Shekatkar -
Tiago de Paula Peixoto