Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- F = file('/Users/Me/Desktop/latex/adjmat.txt','r')
- L = map(lambda x: x.split(';'),F.readlines())[0]
- L = [L[0][1:]] + L[1:-1] + [L[-1][:-1]]
- F.close
- S = ''
- for i in range(len(L)):
- tempL = map(lambda x: x.split(','),[L[i]])[0]
- for j in range(i+1,len(tempL)):
- if tempL[j] == '1':
- S += '\draw (p%g)--(p%g);n'%(i+1,j+1)
- G = file('/Users/Me/Desktop/latex/adjmat-tikz.txt','w')
- G.write(S[:-1])
- G.close
- [0,1,0;1,0,1;0,1,0]
- begin{tikzpicture}
- node[circle,fill=black,inner sep=1pt] (p1) at (0,0) {};
- node[circle,fill=black,inner sep=1pt] (p2) at (1,0) {};
- node[circle,fill=black,inner sep=1pt] (p3) at (1,1) {};
- input{adjmat-tikz.txt}
- end{tikzpicture}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement