Skip to content

Add a function to create unit weight digraphs or make edge weight functions work with unweighted digraphs #859

@reiniscirpons

Description

@reiniscirpons

It would be nice if there was a function to create an edge-weighted digraph from a given digraph by assigning each edge a weight of 1, e.g. UnitEdgeWeightedDigraph(D). Currently if you want to do this you need to call something like

gap> EdgeWeightedDigraph(D, List(DigraphVertices(D), x -> ListWithIdenticalEntries(OutDegreeOfVertex(D, x), 1)));

which is a bit cumbersome, especially when using the gap REPL. The reason for having such a function is that it is sometimes useful to call weighted digraph functions such as DigraphMaximumFlow on unweighted digraphs by assuming each edge has unit weight.

An alternative would be to modify the weighted graph functions to also accept unweighted digraphs as input, and automatically add unit weights to them if they are unweighted, but this might be a bit harder to maintain.

Metadata

Metadata

Assignees

Labels

difficulty: 0A label for feature requests that should be easyfeature-requestA label for feature requestshelp wantedA label for issues or PRs where help is wantednewcomer-friendlyA label for issues that someone thought might be friendly newcomers.

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions