Search code examples
matrixwolfram-mathematicagraph-theorycombinatoricsadjacency-matrix

What does a matrix array look like for a Johnson graph?


I can't seem to find any examples (or much information at all) of what a matrix array looks like for a Johnson graph. Can anyone send me an example of what their arrays look like?


Solution

  • This directly uses the definition of a Johnson Graph given here Wiki Johnson Graph

    johnsonmatrix[n_, k_] := Module[{s=Select[Subsets[Range[n]], Length[#]==k&]},
      {s, MatrixForm[Table[If[Length[Intersection[s[[i]], s[[j]]]]==k-1, 1, 0],
      {i, Length[s]}, {j, Length[s]}]]}]
    

    and generates the list of subsets which index the rows and columns of the adjacency matrix followed by the adjacency matrix for the graph.

    For example, the first few johnsonmatrix[n,1] generate the complete graphs with n verticies and johnsonmatrix[5, 2] matches the number of verticies and edges given in the example graph in the upper right corner of that wiki page and every vertex has six incident edges. But I haven't manually checked to make absolutely certain that this matrix is isomorphic to the graph shown.

    Please check this carefully to try to make certain that no errors have slipped in.