Skip to content

IsSimpleGraph ​

Whether a Graph has no self-loop and no parallel (repeated) edge.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageSimpleGraphQ✓
IsSimpleGraph(g)true iff g has no self-loop and no two edges with the same endpoints and the same direction-ness.
Typed signatures
TypePackageApplies
(value) -> booleancombinatoricsalways

Domain: Collections

Details
  • Wolfram calls this SimpleGraphQ; this library uses the Is… spelling everywhere.
  • A directed edge and its own reverse (a->b and b->a) are DIFFERENT edges, not a parallel pair -- both can be present in a simple directed graph. Two copies of the SAME undirected edge, or the same directed edge twice, are parallel.

Examples

Basic #
live ↗
InIsSimpleGraph(CompleteGraph(3))\mathrm{IsSimpleGraph}(\mathrm{CompleteGraph}(3))OutTrue\mathrm{True}
live ↗
InIsSimpleGraph(Graph([UndirectedEdge(1,2),UndirectedEdge(2,1)]))\mathrm{IsSimpleGraph}(\mathrm{Graph}(\bigl\lbrack\mathrm{UndirectedEdge}(1, 2), \mathrm{UndirectedEdge}(2, 1)\bigr\rbrack))OutFalse\mathrm{False}
About
Examples2
Checked againstWolfram Language 2 agreeSageMath 2 agree
CrosswalkWolfram Language

Implementation

mappedsagepackages/oracle/src/mappings.ts

See also: IsLoopFreeGraph, IsCompleteGraph