Hi,

I would like to know if there is a computationally efficient way of creating 
edges only if an edge with the same extremities and the same type (= a given 
edge property, in the sense of graph-tool edge properties) does not exist 
already.

Of course I can use the following algorithm:

before creating edge (v1,v2) of type t1:
take all edges out-going from v1:
check how many of them have v2 as target,
among them: check whether one of them has type t1
if yes do not create a new edge and return this one
if not, create a new edge

As this seems to be a bit slow (I have to do many such edge creations) I was 
wondering if there is a more efficient « create-only-if-doesnt-exist-already » 
method, of maybe simply a query method including the type (a single method for 
checking if there exists an edge of a given type between two given vertices).

Thanks in advance

Yannis


-- 
-------------------------------------------------------
Yannis Haralambous
Professor
Institut Mines-Télécom, Télécom Bretagne
Computer Science Department
UMR CNRS 6285 Lab-STICC
Technopôle Brest Iroise
CS 83818, 29238 Brest Cedex 3, France
Email: [email protected]
Internet: http://perso.telecom-bretagne.eu/yannisharalambous/
ICBM address: 48°21'31.57"N 4°34'16.76"W
Twitter: y_haralambous
-------------------------------------------------------
...the ball I threw while playing in the park
has not yet reached the ground
(Dylan Thomas)

Es gab eine Zeit, wo ich nur ungern über Schubert sprechen,
nur Nächtens den Bäumen und Sternen von ihm vorerzählen mögen.
(Robert Schumann)

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

Reply via email to