# How to draw graph with named vertices by adjacency matrix?

I have the adjacency matrix of graph and I want visualize this graph. I tried:

{{0,0,0,1,0,1,1,1,0,0},
{0,0,0,0,0,1,1,1,1,1},
{0,0,0,0,0,0,0,1,1,0},
{1,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,1,0,1,0,0},
{1,1,0,0,1,0,1,0,1,1},
{1,1,0,0,0,1,0,0,0,1},
{1,1,1,1,1,0,0,0,0,1},
{0,1,1,0,0,1,0,0,0,0},
{0,1,0,0,0,1,1,1,0,0}}]

and

{{0,0,0,1,0,1,1,1,0,0},
{0,0,0,0,0,1,1,1,1,1},
{0,0,0,0,0,0,0,1,1,0},
{1,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,1,0,1,0,0},
{1,1,0,0,1,0,1,0,1,1},
{1,1,0,0,0,1,0,0,0,1},
{1,1,1,1,1,0,0,0,0,1},
{0,1,1,0,0,1,0,0,0,0},
{0,1,0,0,0,1,1,1,0,0}}]

Output is:

How to add names of vertices to graph?

=================

=================

3

=================

VertexLabelsdoes the job.

{0, 0, 0, 1, 0, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 0, 0, 1, 1, 0},
{1, 0, 0, 0, 0, 0, 0, 1, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 1, 0, 0},
{1, 1, 0, 0, 1, 0, 1, 0, 1, 1},
{1, 1, 0, 0, 0, 1, 0, 0, 0, 1},
{1, 1, 1, 1, 1, 0, 0, 0, 0, 1},
{0, 1, 1, 0, 0, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 1, 1, 0, 0}},
VertexLabels -> Table[i -> Subscript[v, i], {i, 10}]]

{Labeled[v1, “1”],
Labeled[v2, “2”],
Labeled[v3, “3”],
Labeled[v4, “4”],
Labeled[v5, “5”],
Labeled[v6, “6”],
Labeled[v7, “7”],
Labeled[v8, “8”],
Labeled[v9, “9”],
Labeled[v10, “10”]},
{{0,0,0,1,0,1,1,1,0,0},
{0,0,0,0,0,1,1,1,1,1},
{0,0,0,0,0,0,0,1,1,0},
{1,0,0,0,0,0,0,1,0,0},
{0,0,0,0,0,1,0,1,0,0},
{1,1,0,0,1,0,1,0,1,1},
{1,1,0,0,0,1,0,0,0,1},
{1,1,1,1,1,0,0,0,0,1},
{0,1,1,0,0,1,0,0,0,0},
{0,1,0,0,0,1,1,1,0,0}}]

Similarily to the above:

Code:

g = {{0, 0, 0, 1, 0, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 1, 1, 1, 1,
1}, {0, 0, 0, 0, 0, 0, 0, 1, 1, 0}, {1, 0, 0, 0, 0, 0, 0, 1, 0,
0}, {0, 0, 0, 0, 0, 1, 0, 1, 0, 0}, {1, 1, 0, 0, 1, 0, 1, 0, 1,
1}, {1, 1, 0, 0, 0, 1, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 0, 0, 0, 0,
1}, {0, 1, 1, 0, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 1, 1, 0,
0}};