Module: IGraph

Defined in:
lib/igraph.rb,
lib/igraph/version.rb,
lib/igraph/libigraph.rb,
lib/igraph/libigraph/error.rb,
lib/igraph/libigraph/games.rb,
lib/igraph/libigraph/paths.rb,
lib/igraph/libigraph/matrix.rb,
lib/igraph/libigraph/vector.rb,
lib/igraph/libigraph/datatype.rb,
lib/igraph/libigraph/topology.rb,
lib/igraph/libigraph/bipartite.rb,
lib/igraph/libigraph/constants.rb,
lib/igraph/libigraph/interface.rb,
lib/igraph/libigraph/operators.rb,
lib/igraph/libigraph/centrality.rb,
lib/igraph/libigraph/structural.rb,
lib/igraph/libigraph/constructors.rb,
lib/igraph/libigraph/transitivity.rb

Defined Under Namespace

Modules: LibIGraph Classes: Error

Constant Summary collapse

VERSION =
"0.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.lib_pathObject

Returns the value of attribute lib_path.



9
10
11
# File 'lib/igraph.rb', line 9

def lib_path
  @lib_path
end

Class Method Details

.search_igraph(name = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/igraph.rb', line 11

def search_igraph(name = nil)
  name ||= "libigraph.#{FFI::Platform::LIBSUFFIX}"
  lib_path = if ENV["IGRAPHDIR"]
               File.expand_path(name, ENV["IGRAPHDIR"])
             else
               File.expand_path("../vendor/#{name}", __dir__)
             end
  return lib_path if File.exist?(lib_path)

  begin
    require "pkg-config"
    lib_dir = PKGConfig.variable("igraph", "libdir")
    lib_path = File.expand_path(name, lib_dir)
  rescue PackageConfig::NotFoundError
    warn "igraph.pc was not found in the pkg-config search path."
  end
  return lib_path if File.exist?(lib_path)

  warn "igraph shared library '#{name}' not found."
end

.search_igraph_windowsObject



32
33
34
35
36
37
38
39
40
# File 'lib/igraph.rb', line 32

def search_igraph_windows
  ENV["IGRAPHDIR"] ||= [
    RubyInstaller::Runtime.msys2_installation.msys_path,
    RubyInstaller::Runtime.msys2_installation.mingwarch
  ].join(File::ALT_SEPARATOR)
  path = File.expand_path("bin/libigraph.dll", ENV["IGRAPHDIR"])
  RubyInstaller::Runtime.add_dll_directory(File.dirname(path))
  path
end