# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Change an undirected graph into a mixed graph

Contributed by:
Peter Burbery

ResourceFunction["RandomMixedGraph"][{ creates a random graph with | |

ResourceFunction["RandomMixedGraph"][{ creates a table of random graphs with dimensions given by |

A mixed graph is one with both directed and undirected edges. ResourceFunction["RandomMixedGraph"] produces a mixed graph by making a random graph and converting a fraction of undirected edges into directed edges.

Generate a random mixed graph with 20 nodes (vertices) and 48 edges, with a fraction of 0.75 arcs (edges):

In[1]:= |

Out[1]= |

Generate a graph with 0.5 directed edges:

In[2]:= |

Out[2]= |

Generate a list of random mixed graphs:

In[3]:= |

Out[3]= |

Generate an array of mixed graphs:

In[4]:= |

Out[4]= |

Generate a random spatial graph with 148 nodes and 0.68 directed edges:

In[5]:= |

Out[5]= |

Generate a list of random mixed graphs with the Barabasi-Albert graph distribution:

In[6]:= |

Out[6]= |

Generate a 2x3 array of random graphs based on PriceGraphDistribution:

In[7]:= |

Out[7]= |

Make a big mixed graph:

In[8]:= |

Out[8]= |

Evaluate if a mixed graph has a Hamiltonian cycle:

In[9]:= |

Out[9]= |

In[10]:= |

Out[10]= |

Find the graph union of two mixed graphs:

In[11]:= |

Out[11]= |

Make an indexed mixed graph:

In[12]:= |

Out[12]= |

Reverse the directed edges of a mixed graph:

In[13]:= |

Out[13]= |

Compute the graph product for various definitions for two mixed graphs:

In[14]:= |

Out[14]= |

In[15]:= |

Out[15]= |

The graphs can be very very big:

In[16]:= |

Out[16]= |

Apply binary graph operations to two small mixed graphs:

In[17]:= |

Out[17]= |

In[18]:= |

Out[18]= |

In[19]:= |

Out[19]= |

Compute unary graph operations on a large random mixed graph:

In[20]:= |

Out[20]= |

Verify the output of the function produces a mixed graph:

In[21]:= |

Out[21]= |

- 1.0.0 – 25 July 2022

This work is licensed under a Creative Commons Attribution 4.0 International License