# Functions with graph vertix

I am new to Mathematica, trying to use it to study network structure. I am having trouble with creating this code.

Here are the steps I need to do:

• First, generate a graph. Let's say a regular graph with 10 vertices and degree 5. Since the RegularGraph command is no longer usable (Combinatorica has been replaced), I had to make do with
RandomGraph[DegreeGraphDistribution[ConstantArray[5, 10]]]


Is there any better suggestion?

• Second, create a dataset. For simplicity:
d = Tuples[{1, 2}, 10]

• Third, assign the value in each row of the above dataset to the vertice in the graph. This is where I got stuck. I could not find any documentation regarding this issue. Since I might not have been clear on what I want to do, I will give an example. In the above graph, we have 10 vertices. Let's call the 10 vertices x1,x2,x3,x4,x5,x6,x7,x8,x9,x10. The first row of my created dataset has the value:
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}


So I want to set x1=1,x2=1,...,x10=1.

• Finally, do an function on the vertice given their connection. For example, in the above graph, since x1, x2, x3 are connected, I want to create a function f(x1)=x1+x2+x3. I have no clue on how to do this part as well.

Thank you very much!

• Wouldn't you want RandomGraph[DegreeGraphDistribution[ConstantArray[5, 10]]] for a 10 node regular graph with degree 5? Aug 12, 2022 at 22:04
• Thanks! I fixed it Aug 12, 2022 at 22:05
• Make sure you check out her help guides it the help documentation, particularly: guide/GraphConstructionAndRepresentation guide/GraphPropertiesAndMeasurements guide/GraphsAndMatrices Aug 12, 2022 at 22:15
• AdjacencyMatrix[graph] might be useful. Aug 12, 2022 at 22:27

First we create the graph and as the graph has 10 vertices, 10 tuples:

gr = RandomGraph[DegreeGraphDistribution[ConstantArray[5, 10]]]
d = Take[Tuples[{1, 2}, 4], 10]


Then we assign the tuples to vertices:

Graph[gr, VertexLabels -> Table[i -> ToString@d[[i]], {i, 10}]]


Finally we get the adjacency matrix:

AdjacencyMatrix[gr] // MatrixForm