       • To: mathgroup at smc.vnet.net
• From: Bruce Miller <brucem at wolfram.com>
• Date: Fri, 28 Apr 2006 06:33:22 -0400 (EDT)
• References: <200604270626.CAA29179@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```M. Jaccard,

FromAdjacencyMatrix defaults to an undirected graph.
There is an option, Type, to control this.

FromAdjacencyMatrix[m] constructs a graph from a given
adjacency matrix m, using a circular embedding.
FromAdjacencyMatrix[m, v]  uses v as the embedding for the
resulting graph. An option Type that takes on the values
Directed or Undirected can be used to affect the type of
graph produced. The default value of Type is Undirected.
in m as edge weights, with infinity representing missing edges,
and from this constructs a weighted graph using a circular
embedding. FromAdjacencyMatrix[m, v, EdgeWeight] uses v as
the embedding for the resulting graph. The option Type can
be used along with the EdgeWeight tag.

In:= \$Version

Out=
5.2 for Mac OS X (February 24, 2006)

In:= <<DiscreteMath`

In:= paires = {{1, 2}, {2, 3}, {2, 4}, {4, 4}};
g = FromOrderedPairs[paires];
ShowGraph[g, VertexLabel -> {1, 2, 3, 4}];

Out=
{{0, 1, 0, 0}, {0, 0, 1, 1}, {0, 0, 0, 0}, {0, 0, 0, 1}}

Out=
{{0, 1, 0, 0}, {1, 0, 1, 1}, {0, 1, 0, 0}, {0, 1, 0, 1}}

Directed]]

Out=
{{0, 1, 0, 0}, {0, 0, 1, 1}, {0, 0, 0, 0}, {0, 0, 0, 1}}

Similarly for

Bruce Miller
Technical Support
Wolfram Research, Inc.
support at wolfram.com
http://support.wolfram.com/

On Apr 27, 2006, at 1:26 AM, Jaccard Florian wrote:

> Let us set :
>
> paires = {{1, 2}, {2, 3}, {2, 4}, {4, 4}}
>
> The graph is given by :
>
> g = FromOrderedPairs[paires];
>
> ShowGraph[g, VertexLabel -> {1, 2, 3, 4}]
>
> The matrix representation of this relation is given by :
>
>