Skip to content

Commit

Permalink
Merge pull request #24 from sisl/julia7
Browse files Browse the repository at this point in the history
Julia 0.7-beta2 updates
  • Loading branch information
tawheeler authored Aug 4, 2018
2 parents 4e11322 + fc4f443 commit 905125e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ language: julia
sudo: required
dist: trusty
julia:
- 0.5
- 0.6
- 0.7
- nightly
matrix:
allow_failures:
Expand Down
7 changes: 3 additions & 4 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
julia 0.5
TikzPictures 0.3.5
LightGraphs 0.6.0
Compat 0.8.0
julia 0.7-beta2
TikzPictures 2.0.0
LightGraphs 0.13.1
1 change: 1 addition & 0 deletions doc/TikzGraphs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"metadata": {},
"outputs": [],
"source": [
"using Pkg\n",
"Pkg.add(\"TikzGraphs\")"
]
},
Expand Down
20 changes: 8 additions & 12 deletions src/TikzGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,32 @@ module TikzGraphs
export plot, Layouts
import LightGraphs: DiGraph, Graph, vertices, edges, src, dst

using Compat
import Compat.String

preamble = readstring(joinpath(dirname(@__FILE__), "..", "src", "preamble.tex"))
preamble = read(joinpath(dirname(@__FILE__), "..", "src", "preamble.tex"), String)

const AbstractGraph = Union{Graph, DiGraph}

using TikzPictures

module Layouts
using Compat
export Layered, Spring, SimpleNecklace

@compat abstract type Layout end
abstract type Layout end

immutable Layered <: Layout end
struct Layered <: Layout end

immutable Spring <: Layout
struct Spring <: Layout
randomSeed
Spring(;randomSeed=42) = new(randomSeed)
end

immutable SimpleNecklace <: Layout
struct SimpleNecklace <: Layout
end
end

using .Layouts

plot{T<:AbstractString}(g, layout::Layouts.Layout, labels::Vector{T}=map(string, vertices(g)); args...) = plot(g; layout=layout, labels=labels, args...)
plot{T<:AbstractString}(g, labels::Vector{T}; args...) = plot(g; layout=Layered(), labels=labels, args...)
plot(g, layout::Layouts.Layout, labels::Vector{T}=map(string, vertices(g)); args...) where {T<:AbstractString} = plot(g; layout=layout, labels=labels, args...)
plot(g, labels::Vector{T}; args...) where {T<:AbstractString} = plot(g; layout=Layered(), labels=labels, args...)

function edgeHelper(o::IOBuffer, a, b, edge_labels, edge_styles, edge_style)
print(o, " [$(edge_style),")
Expand All @@ -59,7 +55,7 @@ end
edge_str(g::DiGraph) = "->"
edge_str(g::Graph) = "--"

function plot{T<:AbstractString}(g::AbstractGraph; layout::Layouts.Layout = Layered(), labels::Vector{T}=map(string, vertices(g)), edge_labels::Dict = Dict(), node_styles::Dict = Dict(), node_style="", edge_styles::Dict = Dict(), edge_style="", options="")
function plot(g::AbstractGraph; layout::Layouts.Layout = Layered(), labels::Vector{T}=map(string, vertices(g)), edge_labels::Dict = Dict(), node_styles::Dict = Dict(), node_style="", edge_styles::Dict = Dict(), edge_style="", options="") where T<:AbstractString
o = IOBuffer()
println(o, "\\graph [$(layoutname(layout)), $(options_str(layout))] {")
for v in vertices(g)
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TikzGraphs
using Base.Test
using Test

@assert success(`lualatex -v`)
using NBInclude
nbinclude(joinpath(dirname(@__FILE__), "..", "doc", "TikzGraphs.ipynb"))
@nbinclude joinpath(dirname(@__FILE__), "..", "doc", "TikzGraphs.ipynb")

0 comments on commit 905125e

Please sign in to comment.