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

强颜欢笑 提交于 2020-01-05 05:10:01

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/45808407/what-does-a-matrix-array-look-like-for-a-johnson-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!