---
name: "Graph::Matrix"
section: "3pm"
platform: "linux"
package: "libgraph-perl"
version: "1:0.9735-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Graph::Matrix"
---

# Graph::Matrix(3pm)

create and manipulate a V x V matrix of graph G

## NAME

Graph::Matrix - create and manipulate a V x V matrix of graph G

## SYNOPSIS

```
    use Graph::Matrix;
    use Graph::Directed;
    my $g  = Graph::Directed->new;
    $g->add_...(); # build $g
    my $m = Graph::Matrix->new($g);
    $m->get($u, $v)
    $s->get($u, $v, $val)
```

## DESCRIPTION

**This module is meant for internal use by the Graph module.**

### Class Methods

- new($g)

  Construct a new Matrix from the Graph `$g`.

### Object Methods

- get($u, $v)

  Return the value at the edge from `$u` to `$v`.

- set($u, $v, $val)

  Set the edge from `$u` to `$v` to value `$val`.

- stringify

  Returns a string roughly representing the matrix, with the `$u` down the left-hand side, and `$v` across the top.

## AUTHOR AND COPYRIGHT

Jarkko Hietaniemi *jhi@iki.fi*

## LICENSE

This module is licensed under the same terms as Perl itself.
