-
Notifications
You must be signed in to change notification settings - Fork 14
The AtomGraph Type
Rachel Kurchin edited this page Oct 14, 2020
·
2 revisions
AtomGraph is a type defined by ChemistryFeaturization.jl. It is a subtype of LightGraphs.AbstractGraph{Float32}
(we've chosen to fix 32-bit floats for now to maintain compatibility with Flux.jl), and has all the required functions defined such that most of the LightGraphs API should "just work" on these objects.
-
graph::SimpleWeightedGraph{Int32,Float32}
: The actual graph object we are encoding. -
elements::Vector{String}
: List of elemental symbols corresponding to nodes of the graph (length should be equal tonv(graph)
) -
lapl::Matrix{Float32}
: Normalized laplacian of the graph, stored so that graph convolutional layers can be more computationally efficient by not needing to compute it themselves -
features::Matrix{Float32}
: Feature matrix corresponding to this atomic graph. Its shape should be (# features, # nodes). -
featurization::Vector{AtomFeat}
: Featurization scheme (see Terminology) in the form of a list of AtomFeat objects.
Note that it is possible to initialize an AtomGraph object without the final two fields being populated, but not to add only a feature matrix without its associated featurization scheme. This is to ensure that features are always invertible back to human-interpretable values!
- Full constructor
AtomGraph(gr::SimpleWeightedGraph{Int32,Float32}, el_list::Vector{String}, features::Matrix{Float32}, featurization::Vector{AtomFeat})
, requiring inputs of all fields except for the laplacian, which will be computed. This constructor also verifies that the element list and feature matrix are of appropriate dimensions - Constructor
AtomGraph(gr::SimpleWeightedGraph{Int32,Float32}, el_list::Vector{String})
that requires only the graph and the element list, which does not initialize the feature matrix or featurization fields. -
add_features!(g::AtomGraph, features::Matrix{Float32}, featurization::Vector{AtomFeat})
to associate a feature matrix and featurization scheme with an AtomGraph that was initialized via the second constructor, OR to modify them for a fully-initialized case - Several alternate signatures for
add_features!
that can build the features/featurization given requisite metadata -
visualize_graph(ag::AtomGraph)
which simply calls GraphPlot.jl'sgplot
function with nodes labeled with their elemental symbol and edge widths drawn according to their weights