Removing duplicate graph states

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Removing duplicate graph states

snehal
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

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Removing duplicate graph states

Tiago Peixoto
Administrator
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 <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: Removing duplicate graph states

snehal
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 <[hidden email]> 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 <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool




--
Snehal M. Shekatkar
Pune
India

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Removing duplicate graph states

Tiago Peixoto
Administrator
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 <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (849 bytes) Download Attachment
--
Tiago de Paula Peixoto <tiago@skewed.de>
Reply | Threaded
Open this post in threaded view
|

Re: Removing duplicate graph states

snehal
That works! Thanks a lot.

On Sun, Dec 3, 2017 at 9:47 PM, Tiago de Paula Peixoto <[hidden email]> 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 <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool




--
Snehal M. Shekatkar
Pune
India

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool