Function Repository Resource:

UndirectedGraphToMixedGraph

Source Notebook

Change an undirected graph into a mixed graph

Contributed by: Peter Burbery

ResourceFunction["UndirectedGraphToMixedGraph"][graph, frac]

randomly replaces a fraction frac of graph's undirected edges with directed edges.

Details

A mixed graph is one with both directed and undirected edges. ResourceFunction["UndirectedGraphToMixedGraph"] takes the undirected input graph and produces a mixed graph by replacing a random sample of graph's edges with randomly-oriented directed edges.
The input frac should be a number between 0 and 1 that determines the fraction of undirected edges which are coverted to directed edges. A frac value of 0 returns the original graph. A frac value of 1 produces a fully-directed graph (with randomly-oriented edges). A frac value of 0.5 would make approximately 50% of the edges directed.

Examples

Basic Examples (3) 

Make a parametric Harary graph mixed:

In[1]:=
ResourceFunction["UndirectedGraphToMixedGraph"][
 HararyGraph[7, 21], .5]
Out[1]=

Construct a circulant graph with 35% directed edges:

In[2]:=
ResourceFunction["UndirectedGraphToMixedGraph"][
 CirculantGraph[27, {1, 8}], 0.35]
Out[2]=

Generate a random spatial graph and take the largest connected component by edge count:

In[3]:=
\[ScriptCapitalG] = Graph[First[
   TakeLargestBy[
    ConnectedGraphComponents@
     RandomGraph[SpatialGraphDistribution[148, E^-2]], EdgeCount, 1]],
   ImageSize -> Full]
In[4]:=
\!\(
TagBox[\!\(\*
GraphicsBox[
NamespaceBox["NetworkGraphics",
DynamicModuleBox[{Typeset`graph = HoldComplete[
Graph[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148}, {Null, CompressedData["
1:eJwVxWkjKgsAAFBEqCY1yljSSgs10aZUbgslNWWItI8kdJMopdBmScpomR98
3/tyjiBxd5QYGxkZWf2P/ydRp2lTAECfYgAMEhNg0pkkFhkCoelF2uIkZ4mz
tMxZnubSuItcMg/iUfgkAV3AFLAEoBAS0kWzovnVSTFHvCDlS9ky/rp0fUw+
L1+VkxU8xZoChCFYCEuUYxvyjelN2iZ3c0ElUUlVShVJPa6mqllqgRrQMDQ0
7YyWrV3UcrUkHUVH1TF1At3c1ph+Xr+ql+sBA93AMDANIoPGML+9ui3f1m+T
jZCRZ1QYYSNogkxCE2wCzZBZaIbNszuinc0/bMuCRWaZsbKtMqvWCtiYNp1t
yg7YGXaNfXJ3aZezu7wr3p3boziojnmH3rHtoDnZTq5z02lxruz/2Ze61lzr
LoVr9oB1sHNAc7Pdi26uW+u2uK1upxvw0D0MD9Mj8mg8Bo/NQ0ZABEJ4iBCB
ESNiQswI2cvzrnkVXqMX8NF9DB/TJ/JpfAafxzdzqD0koyAKoTxUiMKoETWh
ZhRBZ44OjyTHyuPNY+exxK/07/uP/RsnE6emUzAABYQBOGAKIAE0MHN2eHZ0
Rg7ygmtBRdAbpIeYIVHIEPKEfCFamB3mhrVhS9gadobdYU5kJbIfmYyKo/Yo
KUaNsWKCmDqmi/Hj0vh6XBF3xckYiEEYD1NgMGbEzBiCeTEUC2Ky87XzicRc
Yi+xf+G/iFxQkvyk5FJ56b8EU1CKlxKm4JQpZU4hKTQVSGGpqSvgyn41fU27
XrzmXmuvD69nbg5vjm7ObihpflqXtqWT6dGMLPM3M357ckvKUrPMrCCrzuqy
tmwsy7jT3EXvJnJzub3caS6Rm7wX30fv7+63HowPnLw4H8lH8xd5fkFaWC+4
CvFCsgA+Ch/hR9Nj4JFflBbXi65ivJgsFoqkEqVELalLupKjFCulS9kS62nn
6eBpoSwpK8uqsrN8XJZVLJXzyt9KpjL+fPJ8+8x5Eb9EXi5e8i/jryevt6/P
r1NVoMqoaqr2arR6V6XU+DVdzVFL1tK1Uk1SV9X99cv6VZ3S0DVsjWQj3cg2
So1aY7LJaS43xc3dZrR535x4O33Lvc29b73vvSfec++yj7WP84/MR+Vj7FP+
ufGp/zz5lLSULVXL37pslVv1Fuvr4Ovpa7TNbsva1namXWkvfMu+Ld/n35Xv
j29OZ6Wz34l0Ljr5zktnoSvpSruq7mW33m116T+zP6KfnZ+Dn9DPFA7gdJyB
M3ENbsBtuB334D78Cq/i/N/k79Vv/bf7u9rb7rl68d5Dr9gj96E+r6/oG/tI
39sP9rE+OIAHpsHpIDB4HIwO2UPZ0DrMDCvD9pBMgARE8AgFARNGwkwghJdA
iSCBESmiT/wDu486PA==
"]}, {GraphLayout -> {"Dimension" -> 2}, ImageSize -> Full, VertexCoordinates -> CompressedData["
1:eJwVVms4FAgXnnVpZ1W2RZJtC5tIvmprtIheK5Uit5IWMYRF9ltJoovk0kpE
WwpfMSVMWJeojRrk1riPcWcwxpiLuVk7W+3n9s334zznec6f85z3vO95j77/
L26BSgQC4b4i/p/3xMz/qObEh4m3vCaIJcW6mL6b9KgKUCvYF2RXJmDDb+lw
GezD66f7F+UR7ZgzvTEe4fEa5nnzGsas9yBcdhHadUYiZ286ebRMiNR/WWoc
oA7A/0e1Zu2PAhTjWdt8qhCM385bXNV/gYCfi+SaqjOw+SnYusKRgd2Pnb32
sWTg1h6vuWPKg/1GyWR30BBOa1p7ZX81AptirQW9/d14u6b53GA6E7YbIoM4
HRKEPlipS7o4A43qA+fuWk4h+vqOwrvX2mFe/d6O9GEMFUtliUV5DTjQUZOu
fUqMbcapD8fcxdg0HE83k3MgaNQtOHS6EeKyX89Hr4whqzD+1tmJ98hwfmSj
59OLOvufRrrkYryVvuyhRg2AUPZGev2CH3abpQoIG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b6q
X91e7Yl3xVHxvTgvfhE3JUqJSnIs8UsuJWVJXdKSdKXrUpXUJY1LC9KitCuz
yKyyc1lGVpF9yNqyb9lwTbHmWvOuBdfO1z7WXevx9cJ6Ub4h18u35Z8Ko8Kl
8CqCirgCU/QVBGyETbAZRmAUDsAYnIIf4QFMKFXKY6VfeaksK1sbJxufm382
nZvHqrKqrmqpuuqYOqsuaQwau8aj8WnuNFUNrrVq3dpDbVh7rbPpYrq0Lqsr
6Wq6xtbD1rt+W+/Qfxo8Bp8hZMC3Hds9I2L0GlEjZnww9o2ECTGhplNTwJQy
PZoGZsSMmjFzykzsHOw87fz82bc4LW5L2FKxfFvd1rC1bR3aPLa0LWtr2HB7
1H5lr9rx3eZeYi+39+4oOWpOt/PYGXaW9/37kf2L/Y4r7iq4iq7ewdPB18GP
O+zxeUIeHEGRAIIhKaSPEN6gF/P2vYQv5MMPjw7PDq8Pb9AAiqEplDg6O7o5
9h+X/Rf+S3/d3zq5PXk+eT35PM2dvp0OAqnAY2BwdhPEgv0gEfqJXETykZdI
J3oXvY/mo9VoM5aNleKFeDHew1JYHyPOK+cf59+JXOL9In/xctFJppOFZDFZ
SzaSv5f1y9ZlN0Vc1a/wq990KV1LN/5m/lYylcxHpp0Z3j7fvmZL2cbd/V01
95Z7v28+9PIv+U6h+Dgo9kq1UuPpq9yqfFTale/K8Pn1pVPFa416q96t/358
t7rtYfe3T/wDjkk6PA==
"], 0.012656257722019844`]}, 
{Hue[0.6, 0.2, 0.8], EdgeForm[{GrayLevel[0], Opacity[0.7]}], DiskBox[1, 0.012656257722019844], DiskBox[2, 0.012656257722019844], DiskBox[3, 0.012656257722019844], DiskBox[4, 0.012656257722019844], DiskBox[5, 0.012656257722019844], DiskBox[6, 0.012656257722019844], DiskBox[7, 0.012656257722019844], DiskBox[8, 0.012656257722019844], DiskBox[9, 0.012656257722019844], DiskBox[10, 0.012656257722019844], DiskBox[11, 0.012656257722019844], DiskBox[12, 0.012656257722019844], DiskBox[13, 0.012656257722019844], DiskBox[14, 0.012656257722019844], DiskBox[15, 0.012656257722019844], DiskBox[16, 0.012656257722019844], DiskBox[17, 0.012656257722019844], DiskBox[18, 0.012656257722019844], DiskBox[19, 0.012656257722019844], DiskBox[20, 0.012656257722019844], DiskBox[21, 0.012656257722019844], DiskBox[22, 0.012656257722019844], DiskBox[23, 0.012656257722019844], DiskBox[24, 0.012656257722019844], DiskBox[25, 0.012656257722019844], DiskBox[26, 0.012656257722019844], DiskBox[27, 0.012656257722019844], DiskBox[28, 0.012656257722019844], DiskBox[29, 0.012656257722019844], DiskBox[30, 0.012656257722019844], DiskBox[31, 0.012656257722019844], DiskBox[32, 0.012656257722019844], DiskBox[33, 0.012656257722019844], DiskBox[34, 0.012656257722019844], DiskBox[35, 0.012656257722019844], DiskBox[36, 0.012656257722019844], DiskBox[37, 0.012656257722019844], DiskBox[38, 0.012656257722019844], DiskBox[39, 0.012656257722019844], DiskBox[40, 0.012656257722019844], DiskBox[41, 0.012656257722019844], DiskBox[42, 0.012656257722019844], DiskBox[43, 0.012656257722019844], DiskBox[44, 0.012656257722019844], DiskBox[45, 0.012656257722019844], DiskBox[46, 0.012656257722019844], DiskBox[47, 0.012656257722019844], DiskBox[48, 0.012656257722019844], DiskBox[49, 0.012656257722019844], DiskBox[50, 0.012656257722019844], DiskBox[51, 0.012656257722019844], DiskBox[52, 0.012656257722019844], DiskBox[53, 0.012656257722019844], DiskBox[54, 0.012656257722019844], DiskBox[55, 0.012656257722019844], DiskBox[56, 0.012656257722019844], DiskBox[57, 0.012656257722019844], DiskBox[58, 0.012656257722019844], DiskBox[59, 0.012656257722019844], DiskBox[60, 0.012656257722019844], DiskBox[61, 0.012656257722019844], DiskBox[62, 0.012656257722019844], DiskBox[63, 0.012656257722019844], DiskBox[64, 0.012656257722019844], DiskBox[65, 0.012656257722019844], DiskBox[66, 0.012656257722019844], DiskBox[67, 0.012656257722019844], DiskBox[68, 0.012656257722019844], DiskBox[69, 0.012656257722019844], DiskBox[70, 0.012656257722019844], DiskBox[71, 0.012656257722019844], DiskBox[72, 0.012656257722019844], DiskBox[73, 0.012656257722019844], DiskBox[74, 0.012656257722019844], DiskBox[75, 0.012656257722019844], DiskBox[76, 0.012656257722019844], DiskBox[77, 0.012656257722019844], DiskBox[78, 0.012656257722019844], DiskBox[79, 0.012656257722019844], DiskBox[80, 0.012656257722019844], DiskBox[81, 0.012656257722019844], DiskBox[82, 0.012656257722019844], DiskBox[83, 0.012656257722019844], DiskBox[84, 0.012656257722019844], DiskBox[85, 0.012656257722019844], DiskBox[86, 0.012656257722019844], DiskBox[87, 0.012656257722019844], DiskBox[88, 0.012656257722019844], DiskBox[89, 0.012656257722019844], DiskBox[90, 0.012656257722019844], DiskBox[91, 0.012656257722019844], DiskBox[92, 0.012656257722019844], DiskBox[93, 0.012656257722019844], DiskBox[94, 0.012656257722019844], DiskBox[95, 0.012656257722019844], DiskBox[96, 0.012656257722019844], DiskBox[97, 0.012656257722019844], DiskBox[98, 0.012656257722019844], DiskBox[99, 0.012656257722019844], DiskBox[100, 0.012656257722019844], DiskBox[101, 0.012656257722019844], DiskBox[102, 0.012656257722019844], DiskBox[103, 0.012656257722019844], DiskBox[104, 0.012656257722019844], DiskBox[105, 0.012656257722019844], DiskBox[106, 0.012656257722019844], DiskBox[107, 0.012656257722019844], DiskBox[108, 0.012656257722019844], DiskBox[109, 0.012656257722019844], DiskBox[110, 0.012656257722019844], DiskBox[111, 0.012656257722019844], DiskBox[112, 0.012656257722019844], DiskBox[113, 0.012656257722019844], DiskBox[114, 0.012656257722019844], DiskBox[115, 0.012656257722019844], DiskBox[116, 0.012656257722019844], DiskBox[117, 0.012656257722019844], DiskBox[118, 0.012656257722019844], DiskBox[119, 0.012656257722019844], DiskBox[120, 0.012656257722019844], DiskBox[121, 0.012656257722019844], DiskBox[122, 0.012656257722019844], DiskBox[123, 0.012656257722019844], DiskBox[124, 0.012656257722019844], DiskBox[125, 0.012656257722019844], DiskBox[126, 0.012656257722019844], DiskBox[127, 0.012656257722019844], DiskBox[128, 0.012656257722019844], DiskBox[129, 0.012656257722019844], DiskBox[130, 0.012656257722019844], DiskBox[131, 0.012656257722019844], DiskBox[132, 0.012656257722019844], DiskBox[133, 0.012656257722019844], DiskBox[134, 0.012656257722019844], DiskBox[135, 0.012656257722019844], DiskBox[136, 0.012656257722019844], DiskBox[137, 0.012656257722019844], DiskBox[138, 0.012656257722019844], DiskBox[139, 0.012656257722019844], DiskBox[140, 0.012656257722019844], DiskBox[141, 0.012656257722019844], DiskBox[142, 0.012656257722019844], DiskBox[143, 0.012656257722019844], DiskBox[144, 0.012656257722019844], DiskBox[145, 0.012656257722019844], DiskBox[146, 0.012656257722019844], DiskBox[147, 0.012656257722019844], DiskBox[148, 0.012656257722019844]}}]],
MouseAppearanceTag["NetworkGraphics"]],
AllowKernelInitialization->False]],
DefaultBaseStyle->{"NetworkGraphics", FrontEnd`GraphicsHighlightColor -> Hue[0.8, 1., 0.6]},
FormatType->TraditionalForm,
FrameTicks->None,
ImageSize->{393., Automatic}]\),
"ForceRasterization"]\)

Make the graph mixed with 50% directed edges:

In[5]:=
Graph[ResourceFunction[
  "UndirectedGraphToMixedGraph"][\[ScriptCapitalG], .5], ImageSize -> Full]
In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/5c7381d1-ea16-4193-a4fa-73e16b599800"]

Applications (2) 

Create a mixed dodecahedral graph with about 50% directed edges:

In[7]:=
dodecahedralGraph = ResourceFunction["UndirectedGraphToMixedGraph"][
   GraphData["DodecahedralGraph"], .5];

Find a Hamiltonian cycle if it exists:

In[8]:=
FindHamiltonianCycle[
 ResourceFunction["UndirectedGraphToMixedGraph"][
  dodecahedralGraph, .5]]
Out[8]=

Publisher

Peter Burbery

Version History

  • 1.0.0 – 23 June 2022

Related Resources

License Information