Preventing parallel edge creation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Preventing parallel edge creation

Aleksandar Trifunovic
Hi all,

I was looking for a way to prevent adding of parallel edges in the graph i.e. I would like to create a graph that is not a multigraph. Now I do that manually but that is quite prone to bugs. 
Is this possible to do this with graph tool in any way?

The option I would like is the one like the option that boost graph has i.e. graph_traits<adjacency_list>::edge_parallel_category
that can be found on:

Thanks!
Aleks

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

Re: Preventing parallel edge creation

Snehal Shekatkar
What about removing all the parallel edges after creating the graph?

On Thu, Jul 20, 2017 at 7:30 PM, Aleksandar Trifunovic <[hidden email]> wrote:
Hi all,

I was looking for a way to prevent adding of parallel edges in the graph i.e. I would like to create a graph that is not a multigraph. Now I do that manually but that is quite prone to bugs. 
Is this possible to do this with graph tool in any way?

The option I would like is the one like the option that boost graph has i.e. graph_traits<adjacency_list>::edge_parallel_category
that can be found on:

Thanks!
Aleks

_______________________________________________
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
|  
Report Content as Inappropriate

Re: Preventing parallel edge creation

Tiago Peixoto
Administrator
In reply to this post by Aleksandar Trifunovic
On 20.07.2017 15:00, Aleksandar Trifunovic wrote:
> I was looking for a way to prevent adding of parallel edges in the graph
> i.e. I would like to create a graph that is not a multigraph. Now I do that
> manually but that is quite prone to bugs.
> Is this possible to do this with graph tool in any way?

You can check for the existence of an edge with Graph.edge(), and you can
use Graph.edge(s, t, add_missing=True) to fetch edges or add missing ones if
they do not yet exist.

Alternatively, you can remove parallel edges a posteriori with the function
remove_parallel_edges().

> The option I would like is the one like the option that boost graph has i.e.
> graph_traits<adjacency_list>::edge_parallel_category
> that can be found on:
> http://www.boost.org/doc/libs/develop/libs/graph/doc/adjacency_list.html
> <http://www.boost.org/doc/libs/develop/libs/graph/doc/adjacency_list.html>

Something like this would require changing the underlying graph data
structure in ways that would significantly degrade the performance of most
algorithms.

Best,
Tiago

--
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>
Loading...