Function Repository Resource:

# WeightedSimpleGraph (1.0.0)current version: 1.1.0 »

SimpleGraph with edge and vertex weights

Contributed by: Nikolay Murzin
 ResourceFunction["WeightedSimpleGraph"][g] gives the underlying simple graph from the graph g with edge weights corresponding to edge multiplicities. ResourceFunction["WeightedSimpleGraph"][g,f] also applies function f to vertices of the graph g and assigns vertex weights based on produced tally.

## Details and Options

ResourceFunction["WeightedSimpleGraph"][g] removes all self-loops and multiple edges between the same vertices.
Self-loops can also be weighted by including SelfLoopsTrue option.
ResourceFunction["WeightedSimpleGraph"] works with undirected graphs, directed graphs, multigraphs, and mixed graphs.

## Examples

### Basic Examples (2)

Remove multi-edges from a graph and assign edge weights with their multiplicities:

 In[1]:=
 Out[1]=

Merge each vertex using a function and assign vertex weight based on the number of original vertices producing the same result:

 In[2]:=
 Out[2]=

### Options (1)

#### SelfLoops (1)

Self-loops can also be weighted:

 In[3]:=
 Out[3]=

### Applications (1)

Produce weighted evolution graph from its full evolution graph for the MultiwaySystem:

 In[4]:=
 Out[4]=
 In[5]:=
 Out[5]=

### Properties and Relations (1)

Edge weights assigned by WeightedSimpleGraph can also be computed with EdgeMultiplicity:

 In[6]:=
 Out[6]=

## Version History

• 1.1.0 – 03 February 2023
• 1.0.0 – 24 October 2022