I wrote a function in Mathematica that applies certain construction steps on the "incidence matrix" of a graph in order to obtain a new graph with certain properties. These construction steps can be iterated and here is the point where I fail. If I write something like
Henneberg1[Henneberg1[{{{1,1,1,1}}},a,b],c,d]
I get a weird error of the following form:
Now to the implementation:
Henneberg1[mats_, a_, b_] := ...
The first parameter mats_
describes a set of (incidence) matrices where a
and b
are only placeholders for variables to be added.
If I evaluate Henneberg1[{{{1,1,1,1}}},a,b]
I retrieve
$\{\begin{pmatrix} 1 & 1 & 1 & 1 & 0 & 0 \\ a & 1 & 0 & 0 & -a & -1 \\ 0 & 0 & b & 1 & -b & -1 \end{pmatrix}\}$
Directly passing the result as argument for Henneberg1
then works as desired, but I am not able to iterate in the way described above.
The actual implementation of Henneberg1
can be found here, but is quite a mess, so sorry for that.
(What it actually does can be found here (1.))
If someone knows where the problem lies I would really appreciate that.
Henneberg1
getList
as the input and outputsMatrixForm
. you may want to doHenneberg1[List @@ First@Henneberg1[{{{1, 1, 1, 1}}}, a, b], c, d]
$\endgroup$ – Xminer Jun 26 '19 at 11:56MatrixForm
in functions that do computations. Only use it as an afterthought (//
) to print matrices to your notebook. E.g.,Henneberg1[{{{1,1,1,1}}},a,b] // MatrixForm
. All functions that end inForm
are meant for output formatting only, not for use in intermediate results. $\endgroup$ – Sjoerd Smit Jun 26 '19 at 12:58