# Class "adjacencyMatrix"

### Description

A class for adjacency matrix representation of simple-graphs

### Objects from the Class

Objects can be created by calls of the form `new("adjacencyMatrix",X)`

.

### Slots

`.Data`

:Object of class

`"matrix"`

; standard 0-1 coding for ordinary directed and undirected edges

### Extends

Class `"matrix"`

, from data part.
Class `"structure"`

, by class `"matrix"`

.
Class `"array"`

, by class `"matrix"`

.
Class `"vector"`

, by class "matrix", with explicit coerce.

### Methods

- initialize
`signature(.Object = "adjacencyMatrix")`

: constructs an adjacency matrix representation of a simple-graph from a 0-1 matrix- show
`signature(object = "adjacencyMatrix")`

: displays an adjacency matrix representation- names
`signature(x = "adjacencyMatrix")`

: gets the character vertex identifiers of an adjacency matrix- names<-
`signature(x = "adjacencyMatrix")`

: sets the character vertex identifiers of an adjacency matrix- card
`signature(object = "adjacencyMatrix")`

: returns the number of vertices and the total number of edges (directed and undirected) in an incidence matrix- isEmpty
`signature(object = "adjacencyMatrix")`

: an adjacency matrix is empty if it has no entries- isPresent
`signature(el = "undirectedEdge", ou = "adjacencyMatrix")`

: tells whether an undirected edge occurs in the graph represented by an adjacency matrix- isPresent
`signature(el = "directedEdge", ou = "adjacencyMatrix")`

: tells whether a directed edge occurs in the graph represented by an adjacency matrix- areTheSame
`signature(x = "adjacencyMatrix", y = "adjacencyMatrix")`

: x and y are the same adjacency matrix if they represent the same simple-graph- [
`signature(x = "adjacencyMatrix")`

: extracts the adjacency matrix of an induced subgraph- [[
`signature(x = "adjacencyMatrix")`

: extracts the character identifier of a vertex- coerce
`signature(from = "incidenceList", to = "adjacencyMatrix")`

: converts an incidence list to an adjacency matrix by keeping ordinary directed and undirected edges and dropping loops and parallel edges- coerce
`signature(from = "incidenceMatrix", to = "adjacencyMatrix")`

: converts an incidence matrix to an adjacency matrix by dropping hyper-edges, loops and parallel edges- coerce
`signature(from = "adjacencyList", to = "adjacencyMatrix")`

: converts an adjacency list to an adjacency matrix by dropping loops and parallel edges- +
`signature(e1 = "adjacencyMatrix", e2 = "vertexSet")`

: adds a vertex set to an adjacency matrix by making the new vertices isolated- -
`signature(e1 = "adjacencyMatrix", e2 = "vertexSet")`

: removes a vertex set from an adjacency matrix by dropping all edges involving the vertex set- +
`signature(e1 = "adjacencyMatrix", e2 = "undirectedEdge")`

: adds an ordinary undirected edge (not a loop) to an adjacency matrix- +
`signature(e1 = "adjacencyMatrix", e2 = "directedEdge")`

: adds an ordinary directed edge to an adjacency matrix- -
`signature(e1 = "adjacencyMatrix", e2 = "undirectedEdge")`

: removes an undirected edge from an adjacency matrix- -
`signature(e1 = "adjacencyMatrix", e2 = "directedEdge")`

: removes a directed edge from an adjacency matrix- *
`signature(e1 = "adjacencyMatrix", e2 = "vertexSet")`

: restricts an adjacency matrix to a vertex set by dropping all edges involving vertices outside the vertex set

### Warning

All input non-zero diagonal entries are silently changed to zero by the constructor.

### Note

The `names<-`

replacement method works only if the names to be assigned
can be used to construct a `vertexSet`

object having the right cardinality,
otherwise the names are left unchanged and a warning message is given.

### Author(s)

Jens Henrik Badsberg, Claus Dethlefsen, Luca La Rocca

### See Also

`adjacencyMatrix`

and `simpleGraph-class`