Available data - generated adjacency matrices of graphs
It is required to output graph images based on these adjacency matrices
All the solutions I have seen require a separate array of coordinates of each vertex, for this I need to somehow find out the topology of the graph, which is quite difficult.
Is there an easier way to display the graph image?
It should turn out something like this (1st attachment)
I also found the following code, but the problem is that it can only build regular polygons and to build something more complicated, you need to know the topology of the graph
\def\adjancymatrix{%
{
{0,0,0,0,1},%
{0,0,0,0,1},%
{0,0,0,0,1},%
{0,0,0,0,1},%
{1,1,1,1,0}}}
\let\mymatrixcontent\empty
\def\mymatrixcontent{|[draw=none]|\& 1 \& 2 \& 3 \& 4 \& 5\\}
\begin{scope}[local bounding box=middle,xshift=5cm]
\foreach \X in {1,...,5}
{\node[Bullet,label=90+72-\X*72:{$_\X$}] (E\X) at (90-\X*72:2) {} ;}
\foreach \X in {1,...,5}
{\begingroup\edef\x{\endgroup
\noexpand\gappto\noexpand\mymatrixcontent{\X }}\x
\foreach \Y in {1,...,5}
{\pgfmathtruncatemacro{\itest}{\adjancymatrix[\X-1][\Y-1]}
\ifnum\itest=1
\draw (E\X) -- (E\Y);
\begingroup\edef\x{\endgroup
\noexpand\gappto\noexpand\mymatrixcontent{\& 1 }}\x
\else
\begingroup\edef\x{\endgroup
\noexpand\gappto\noexpand\mymatrixcontent{ \&}}\x
\fi
}
\gappto\mymatrixcontent{\\}
}
\end{scope}
\matrix (midmat) [below=of middle,adjacency matrix]{
\mymatrixcontent
};