Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

MixedGraphs

Guides

  • Mixed Graph Functions

Symbols

  • EulerizeGraph
  • EvenDegreeVertexList
  • EvenDegreeVertexQ
  • GeneralizedGraphData
  • GraphConvexHull
  • GraphicalDegreeSequenceQ
  • GraphInformation
  • MixedGraphDirectedArcs
  • MixedGraphToDigraph
  • MixedGraphUndirectedEdges
  • OddDegreeVertexList
  • OddDegreeVertexQ
  • OddNodes
  • RandomMixedGraph
  • RandomSymbolicMixedGraph
  • RandomSymbolicWeightedMixedGraph
  • RandomWeightedMixedGraph
  • TakeLargestGraphComponentBy
  • UndirectedGraphToMixedGraph
PeterBurbery`MixedGraphs`
EulerizeGraph
​
EulerizeGraph[graph]
makes
graph
Eulerian or unicursal by adding edges
​
Details and Options

Examples  
(1)
Basic Examples  
(1)
In[1]:=
Create a random graph
In[1]:=
=RandomGraph[{20,54}]
Out[1]=
Take the largest connected component to ensure that the graph is connected
In[2]:=
TakeLargestGraphComponentBy
[]
Out[2]=


In[3]:=
=First
TakeLargestGraphComponentBy
[]
Out[3]=
 is not Eulerian
In[4]:=
EulerianGraphQ[]
Out[4]=
False
Make the graph  Eulerian:
In[5]:=
EulerizeGraph
[]
Out[5]=
The output is now Eulerian
In[6]:=
EulerianGraphQ
EulerizeGraph
[]
Out[6]=
True
Eulerize a weighted undirected cost by minimizing the sum of added costs:
In[7]:=
randomGraph=
RandomWeightedMixedGraph
[{20,54},0,RandomReal[]&]
Out[7]=
In[8]:=
EulerizeGraph
[randomGraph]
Out[8]=
Find the total cost of all the edges:
In[9]:=
TotalAnnotationValue
EulerizeGraph
[randomGraph],EdgeWeight
Out[9]=
27.7021
Verify the output is an Eulerian graph:
In[10]:=
EulerianGraphQ
EulerizeGraph

RandomWeightedMixedGraph
[{20,54},0,RandomReal[]&]
Out[10]=
True
In[11]:=
Information["EulerizeGraph","Definitions"]
Out[11]=
EulerizeGraph[PeterBurbery`MixedGraphs`Private`graph_?ConnectedGraphQ]:=NestWhile[Function[PeterBurbery`MixedGraphs`Private`x,EdgeAdd[PeterBurbery`MixedGraphs`Private`x,(First[#1]Last[#1]&)[First[TakeDrop[Select[VertexList[PeterBurbery`MixedGraphs`Private`x],OddQ[VertexDegree[PeterBurbery`MixedGraphs`Private`x,#1]]&],2]]]]],PeterBurbery`MixedGraphs`Private`graph,!EulerianGraphQ[#1]&]
In[12]:=
EdgeAdd[randomGraph,FindEdgeCover[Subgraph[HighlightGraph[randomGraph,VertexList[randomGraph,x_/;OddQ@VertexDegree[randomGraph,x]]],VertexList[randomGraph,x_/;OddQ@VertexDegree[randomGraph,x]]]]]
Out[12]=
In[13]:=
AnnotationValue[EdgeAdd[randomGraph,FindEdgeCover[Subgraph[HighlightGraph[randomGraph,VertexList[randomGraph,x_/;OddQ@VertexDegree[randomGraph,x]]],VertexList[randomGraph,x_/;OddQ@VertexDegree[randomGraph,x]]]]],EdgeWeight]
Out[13]=
{0.418545,0.458955,0.618019,0.13752,0.13752,0.43602,0.387545,0.51555,0.668035,0.294533,0.0413438,0.831391,0.954368,0.237354,0.150538,0.150538,0.354953,0.122044,0.0945244,0.846345,0.210112,0.315315,0.429006,0.355641,0.694584,0.70066,0.511347,0.114417,0.61776,0.719946,0.349627,0.605414,0.890711,0.406338,0.687846,0.216243,0.755029,0.795203,0.360386,0.908513,0.908513,0.204874,0.614224,0.460716,0.763091,0.967001,0.634596,0.250761,0.691057,0.865292,0.167025,0.167025,0.508468,0.972241,0.601887,0.479069,0.566716,0.566716,0.0844546}

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com