Hi Robert,

>For example, if I could store a graph in a sqlite database, I'd like
>to query the database to know if the graph contains a Eulerian
>path[1].

I may be driven by a misleading uneducated impression, but given the 
nature of most graph-related algorithms --I see the search for Eulerian 
path as an exception-- I'd be surprised if SQL would prove superior to 
a decent application-level implementation.

I don't mean it can't be done with SQL[ite], but the cost of access to 
vertice/edges data seems very high to me, compared to, say, a C 
implementation using a classical data structure.

If your actual problem is exactly what you state above, then you can 
indeed determine if a graph is Eulerian by storing or computing the 
degree of each vertex.  I believe it can be done simply with a trigger 
at the time you insert an edge.  Then querying for Eulerian circuit 
property is equivalent to looking for "no odd degree within vertices" 
and Eulerian path is "only two vertices (start and end) have an odd 
degree".

If you store your graph in SQLite only for that query, then I would 
question the usefulness of SQLite compared to a more classical 
solution.  It all depends on the "life" of your vertices/edges/graphs.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to