An open API service indexing awesome lists of open source software.

https://github.com/quantumbfs/multigraphs.jl

A multigraph extension of Graphs.jl
https://github.com/quantumbfs/multigraphs.jl

Last synced: 8 months ago
JSON representation

A multigraph extension of Graphs.jl

Awesome Lists containing this project

README

          

# Multigraphs

[![CI](https://github.com/QuantumBFS/Multigraphs.jl/workflows/CI/badge.svg)](https://github.com/QuantumBFS/Multigraphs.jl/actions)
[![Codecov](https://codecov.io/gh/QuantumBFS/Multigraphs.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/QuantumBFS/Multigraphs.jl)

Multigraphs extension for `Graphs.jl`.

## Installation


Multigraphs is a  


Julia Language

  package. To install Multigraphs,
please open
Julia's interactive session (known as REPL)
and press ] key in the REPL to use the package mode, then type the following command

```julia
pkg> add Multigraphs
```

## Examples

```julia
julia> using Graphs, Multigraphs

# create a undirected multigraph with 3 vertices and 0 multiple edges
# use DiMultigraph for directed multigraphs
julia> mg = Multigraph(3)
{3, 0} undirected Int64 multigraph with Int64 multiplicities

# add a multiple edge from 1 to 2 with multiplicity 2
julia> add_edge!(mg, 1, 2, 2)
true

# add a simple edge (multiple edge with multiplicity 1) from 2 to 3
julia> add_edge!(mg, 2, 3)
true

# this will increase multiplicity of the edge from 2 to 3 by 2
julia> add_edge!(mg, 2, 3, 2)
true

# this will decrease multiplicity of the edge from 2 to 3 by 1
julia> rem_edge!(mg, 2, 3, 2)

# here me is a MultipleEdge
julia> mes = [me for me in edges(mg)]
2-element Array{MultipleEdge{Int64,Int64},1}:
Multiple edge 1 => 2 with multiplicity 2
Multiple edge 2 => 3 with multiplicity 1

# here e is a Graphs.SimpleEdge
julia> for e in mes[1]
println(e)
end
Edge 1 => 2
Edge 1 => 2

```

## License

MIT License