Recognizing equal graphs

37 views
Skip to first unread message

Mahdi Negahi

unread,
Apr 28, 2012, 11:46:34 PM4/28/12
to ne...@googlegroups.com
Is there any tools or open source code that recognized two graph is equal?

Duane Nickull

unread,
Apr 29, 2012, 12:08:52 AM4/29/12
to ne...@googlegroups.com
I am not aware of any. Is the function you are looking for KIF equivalent
of
(forall (?X ?Y)(?y ?x)) at the graph (or instance?) level?

To do this manually, you would likely have to create Cypher queries for
each nodes and relationship if you wanted to detect even a minor variance.
This would involve starting with the root node and expanding outwards
then comparing results.Since neo4J is disk based,side stepping the neo4J
libs/API's using a GREP style command might work depending on how critical
your results need to be?

CAVEAT: I want to let you know that I am not a Neo4J jedi master so
please check with others who are more knowledgable that I.I could not find
any API's that did a Compare (Datastore datastore1, Datastore datastore2)
type function.

Duane Nickull
@uberity @duanechaos

Mahdi Negahi

unread,
Apr 29, 2012, 12:40:25 AM4/29/12
to ne...@googlegroups.com
thanks for ur reply , ur idea is the same as me. 

now I check manually , two graphs are the same.

Duane Nickull

unread,
Apr 29, 2012, 12:52:57 AM4/29/12
to ne...@googlegroups.com
Glad I could of some help. If you find a good way, please share it back with this forum.

Best wishes

Duane Nickull
******************
COO and Director 
Uberity Technology Corporation 
"LiveCycle ES and Mobile Specialists"
@uberity @duanechaos

Michael Hunger

unread,
Apr 29, 2012, 4:39:06 AM4/29/12
to ne...@googlegroups.com, Andres Taylor
It is a bit tricky b/c you have to have a connected graph and the
order of insertion is important.

That's why I'd rather export the graph to a textual format and compare those,
it is important to sort all properties in a consistent order and also
sort all lines of the output, and ignore node, and rel-id's

{ name : "Duane" } -[:KNOWS { since : 2012}]-> { name : "Mahdi" }

when cypher gets the props function (and a map-sort as well) you could do

start n=node(*)
match n-[r]->m
return sort(props(n)) as a , type(r) as b , sort(props(r)) as c ,
sort(props(m)) as d
order by a,b,c,d

Mahdi Negahi

unread,
May 6, 2012, 10:37:13 PM5/6/12
to ne...@googlegroups.com, Andres Taylor


On Sunday, April 29, 2012 4:39:06 PM UTC+8, Michael Hunger wrote:
It is a bit tricky b/c you have to have a connected graph and the
order of insertion is important.

the props function is unknown function


 

Mahdi Negahi

unread,
May 6, 2012, 10:38:28 PM5/6/12
to ne...@googlegroups.com, Andres Taylor
Sorry you explained .....
Reply all
Reply to author
Forward
0 new messages