Use this if you are using igraph from R
Simple graphs are graphs which do not contain loop and multiple edges.
simplify( graph, remove.multiple = TRUE, remove.loops = TRUE, edge.attr.comb = igraph_opt("edge.attr.comb") ) is_simple(graph) simplify_and_colorize(graph)
The graph to work on.
Logical, whether the multiple edges are to be removed.
Logical, whether the loop edges are to be removed.
Specifies what to do with edge attributes, if
A loop edge is an edge for which the two endpoints are the same vertex. Two edges are multiple edges if they have exactly the same two endpoints (for directed graphs order does matter). A graph is simple is it does not contain loop edges and multiple edges.
is_simple checks whether a graph is simple.
simplify removes the loop and/or multiple edges from a graph. If
function returns a simple graph.
simplify_and_colorize constructs a new, simple graph from a graph and
also sets a
color attribute on both the vertices and the edges.
The colors of the vertices represent the number of self-loops that were
originally incident on them, while the colors of the edges represent the
multiplicities of the same edges in the original graph. This allows one to
take into account the edge multiplicities and the number of loop edges in
the VF2 isomorphism algorithm. Other graph, vertex and edge attributes from
the original graph are discarded as the primary purpose of this function is
to facilitate the usage of multigraphs with the VF2 algorithm.
a new graph object with the edges deleted.
Gabor Csardi email@example.com
g <- graph( c(1,2,1,2,3,3) ) is_simple(g) is_simple(simplify(g, remove.loops=FALSE)) is_simple(simplify(g, remove.multiple=FALSE)) is_simple(simplify(g))