Best to give an example. Let us consider the function AdjacencyMatrix
. When we pass, say a matrix to it, we get:
test = {{1,1,1},{1,2,2},{3,3,3}};
AdjacencyMatrix[%]
AdjacencyMatrix::graph: A graph object is expected at position 1 in AdjacencyMatrix[{{1,1,1},{1,2,2},{3,3,3}}].
AdjacencyMatrix[{{1, 1, 1}, {1, 2, 2}, {3, 3, 3}}]
Is there a way of modifying AdjacencyMatrix
so that if the argument isn't a graph object it would simply return the argument itself?
AdjacencyMatrix
to return the argument itself only when it is a matrix, or whenever it is not a graph? $\endgroup$