@staticmethod
def nxgraph_from_data(data, include_groups=True, include_datasets=True,
    include_attributes=True, include_links=True, include_relationships=True):
    """
        Create a networkX representation of the objects in the HiearchyDescription stored in self.data

        :param data: Description of the object hierarchy
        :type data: HierarchyDescription
        :param include_groups: Bool indicating whether we should include groups in the hierarchy
        :param include_datasets: Bool indicating whether we should include datasets in the hierarchy
        :param include_attributes: Bool indicating whether we should include groups in the hierarchy
        :param include_links: Bool indicating whether we should include links in the hierarchy
        :param include_relationships: Bool or list of strings indicating which types of relationships should be included

        :return:  NXGraph from self.data
        """
    import networkx as nx
    graph = nx.Graph()
    if include_datasets:
        for d in data['datasets']:
            graph.add_node(d['name'])
    if include_groups:
        for g in data['groups']:
            graph.add_node(g['name'])
    if include_attributes:
        for g in data['attributes']:
            graph.add_node(g['name'])
    if include_links:
        for l in data['links']:
            graph.add_node(l['name'])
    rel_list = include_relationships if isinstance(include_relationships, list
        ) else data.RELATIONSHIP_TYPES if include_relationships is True else []
    all_nodes = graph.nodes(data=False)
    if len(rel_list) > 0:
        for r in data['relationships']:
            if r['type'] in rel_list:
                if r['source'] in all_nodes and r['target'] in all_nodes:
                    graph.add_edge(r['source'], r['target'])
    return graph
