Ask Your Question

lutherdriggers's profile - activity

2018-08-01 12:44:44 +0200 received badge  Notable Question (source)
2017-07-31 22:10:57 +0200 received badge  Popular Question (source)
2016-01-19 17:24:11 +0200 received badge  Nice Answer (source)
2016-01-18 13:45:08 +0200 received badge  Teacher (source)
2016-01-18 13:45:08 +0200 received badge  Self-Learner (source)
2016-01-18 13:44:41 +0200 received badge  Student (source)
2016-01-18 12:23:47 +0200 received badge  Scholar (source)
2016-01-18 12:23:17 +0200 received badge  Organizer (source)
2016-01-18 12:21:09 +0200 answered a question Change the edge thickness in a graph plot

I figured it out. The answer is do not use GraphPlot. Use GraphLatex. GraphLatex makes fairly nice 2D plots as tikzpicture with latex formatting on labels and lots of great customisations options. I would put a link to the docs but for some reason I don't have any Karma yet and cannot. For large, dense graphs it can be hard to view the whole thing on the default settings that view(H) gives you. In that case export the latex to a file and compile it in a minimal document with resizebox, e.g., as follows:

sage code:

H=graphs.CompleteGraph(100)
H.set_latex_options(
graphic_size=(200,200), #large value helps for large dense graphs
vertex_size=1,
edge_thickness=0.05,)
#view(H) #just display the latex graph in sage or in pdf viewer
with open('graph_tmp.tex','w') as f:
    f.write(latex(H))

latex document:

\documentclass{article}
\usepackage{tkz-graph}
\usepackage{savetrees}
\begin{document}
\resizebox{.9\textwidth}{.9\textwidth}{
  \input{graph_tmp}
}
\end{document}
2016-01-17 18:59:43 +0200 asked a question Change the edge thickness in a graph plot

I want to plot a graph with many edges, but they just end up looking like a black mass. I can see how to change vertex size and whatnot but not edge thickness.

sage: H=graphs.CompleteGraph(100)
sage: H.show()
Launched png viewer for Graphics object consisting of 5051 graphics primitives

Not sure where my karma went, but you can guess what this looks like.

2015-10-26 04:52:52 +0200 received badge  Famous Question (source)
2015-10-23 23:34:48 +0200 received badge  Notable Question (source)
2015-10-23 08:23:54 +0200 received badge  Popular Question (source)
2015-10-22 05:27:46 +0200 commented question calling MixedIntegerLinearProgram gives AssertionError: The given source does not contain 'def'. How to fix this?

Thanks for comment. I have also confirmed it works with the precompiled binary for sage 6.9. I'll close if I manage to compile a fresh copy of sage-6.9 and not reproduce this.

2015-10-22 04:18:39 +0200 asked a question calling MixedIntegerLinearProgram gives AssertionError: The given source does not contain 'def'. How to fix this?

When I call MixedIntegerLinearProgram I get the error AssertionError: The given source does not contain 'def'. This occurs both when calling any of its methods, like MixedIntegerLinearProgram.show(), and when viewing its documentation I get a backtrace in place of the documentation.

I am running Mac OS 10.11 (El Capitan). I get the same error in my emacs sage interpreter and Terminal. I recently tried to upgrade from sage 6.5 to 6.9 and the build failed; ask me about that if you think it's related. sage is installed to my home directory. Please ask if more details are needed.

Below is a full backtrace for a command I tried.

sage: g=Graph({0:[1,3],1:[0,2],2:[1,3],3:[2,0]})
sage: g
Graph on 4 vertices
sage: plot(g) #I checked my graph
sage: g.vertex_cut(0,2)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-17-b3f3e7c533ca> in <module>()
----> 1 g.vertex_cut(Integer(0),Integer(2))

/Users/alejo/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in vertex_cut(self, s, t, value_only, vertices, solver, verbose)
   5525 
   5526         # Some vertices belong to part 1, some others to part 0
-> 5527         p.add_constraint(v[s] == 0)
   5528         p.add_constraint(v[t] == 1)
   5529 

/Users/alejo/sage/src/sage/numerical/mip.pyx in sage.numerical.mip.MIPVariable.__getitem__ (build/cythonized/sage/numerical/mip.c:16841)()
   2560         :meth:`MixedIntegerLinearProgram.new_variable`.
   2561     """
-> 2562 
   2563     def __init__(self, parent, mip, vtype, name, lower_bound, upper_bound):
   2564         r"""

/Users/alejo/sage/src/sage/numerical/mip.pyx in sage.numerical.mip.MixedIntegerLinearProgram.__call__ (build/cythonized/sage/numerical/mip.c:3714)()
    490             self._linear_constraints_parent = LinearConstraintsParent(LF)
    491         return self._linear_constraints_parent
--> 492 
    493     def __call__(self, x):
    494         """

/Users/alejo/sage/src/sage/numerical/mip.pyx in sage.numerical.mip.MixedIntegerLinearProgram.linear_functions_parent (build/cythonized/sage/numerical/mip.c:3376)()
    453         # Check for redundant constraints
    454         self._check_redundant = check_redundant
--> 455         if check_redundant:
    456             self._constraints = list()
    457 

/Users/alejo/sage/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedFunction.__call__ (build/cythonized/sage/misc/cachefunc.c:4678)()
    917             True
    918             sage: f(y) is not f(x)
--> 919             True
    920 
    921         """

/Users/alejo/sage/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedFunction.argfix_init (build/cythonized/sage/misc/cachefunc.c:3203)()
    719         """
    720         A = ArgumentFixer(self.f,classmethod=self.is_classmethod)
--> 721         self._argument_fixer = A
    722         if self.key:
    723             self._fix_to_pos = self._fix_to_pos_and_create_key

/Users/alejo/sage/src/sage/misc/function_mangling.pyx in sage.misc.function_mangling.ArgumentFixer.__init__ (build/cythonized/sage/misc/function_mangling.c:862)()
    122     cdef public tuple _default_tuple
    123     def __init__(self, f, classmethod = False):
--> 124         try:
    125             arg_names, varargs, varkw, defaults = sage_getargspec(f)
    126         except AttributeError:

/Users/alejo/sage/local/lib/python2.7/site-packages/sage/misc/sageinspect.pyc in sage_getargspec(obj)
   1382         source = sage_getsource(obj, is_binary=True)
   1383         if source:
-> 1384             return inspect.ArgSpec(*_sage_getargspec_cython(source))
   1385         else:
   1386             func_obj = obj

/Users/alejo/sage/local/lib/python2.7/site-packages/sage/misc/sageinspect.pyc in _sage_getargspec_cython(source)
   1007     """
   1008     defpos = source ...
(more)