data_loader/data_helper.py
def group_same_size(graphs, labels):
    """
    group graphs of same size to same array
    :param graphs: numpy array of shape (num_of_graphs) of numpy arrays of graphs adjacency matrix
    :param labels: numpy array of labels
    :return: two numpy arrays. graphs arrays in the shape (num of different size graphs) where each entry is a numpy array
            in the shape (number of graphs with this size, num vertex, num. vertex, num vertex labels)
            the second arrayy is labels with correspons shape
    """
    sizes = list(map(lambda t: t.shape[1], graphs))
    indexes = np.argsort(sizes)
    graphs = graphs[indexes]
    labels = labels[indexes]
    r_graphs = []
    r_labels = []
    one_size = []
    start = 0
    size = graphs[0].shape[1]
    for i in range(len(graphs)):
        if graphs[i].shape[1] == size:
            one_size.append(np.expand_dims(graphs[i], axis=0))
        else:
            r_graphs.append(np.concatenate(one_size, axis=0))
            r_labels.append(np.array(labels[start:i]))
            start = i
            one_size = []
            size = graphs[i].shape[1]
            one_size.append(np.expand_dims(graphs[i], axis=0))
    r_graphs.append(np.concatenate(one_size, axis=0))
    r_labels.append(np.array(labels[start:]))
    return r_graphs, r_labels

    group graphs of same size to same array
    :param graphs: numpy array of shape (num_of_graphs) of numpy arrays of graphs adjacency matrix
    :param labels: numpy array of labels
    :return: two numpy arrays. graphs arrays in the shape (num of different size graphs) where each entry is a numpy array
            in the shape (number of graphs with this size, num vertex, num. vertex, num vertex labels)
            the second arrayy is labels with correspons shape
    
group graphs of same size to same array
group graphs of same size to same array
def group_same_size(graphs, labels):
    sizes = list(map(lambda t: t.shape[1], graphs))
    indexes = np.argsort(sizes)
    graphs = graphs[indexes]
    labels = labels[indexes]
    r_graphs = []
    r_labels = []
    one_size = []
    start = 0
    size = graphs[0].shape[1]
    for i in range(len(graphs)):
        if graphs[i].shape[1] == size:
            one_size.append(np.expand_dims(graphs[i], axis=0))
        else:
            r_graphs.append(np.concatenate(one_size, axis=0))
            r_labels.append(np.array(labels[start:i]))
            start = i
            one_size = []
            size = graphs[i].shape[1]
            one_size.append(np.expand_dims(graphs[i], axis=0))
    r_graphs.append(np.concatenate(one_size, axis=0))
    r_labels.append(np.array(labels[start:]))
    return r_graphs, r_labels
def group_same_size ( graphs , labels ) : sizes = list ( map ( lambda t : t . shape [ 1 ] , graphs ) ) indexes = np . argsort ( sizes ) graphs = graphs [ indexes ] labels = labels [ indexes ] r_graphs = [ ] r_labels = [ ] one_size = [ ] start = 0 size = graphs [ 0 ] . shape [ 1 ] for i in range ( len ( graphs ) ) : if graphs [ i ] . shape [ 1 ] == size : one_size . append ( np . expand_dims ( graphs [ i ] , axis = 0 ) ) else : r_graphs . append ( np . concatenate ( one_size , axis = 0 ) ) r_labels . append ( np . array ( labels [ start : i ] ) ) start = i one_size = [ ] size = graphs [ i ] . shape [ 1 ] one_size . append ( np . expand_dims ( graphs [ i ] , axis = 0 ) ) r_graphs . append ( np . concatenate ( one_size , axis = 0 ) ) r_labels . append ( np . array ( labels [ start : ] ) ) return r_graphs , r_labels
group graphs of same size to same array
group graphs of same size to same array
"""
    group graphs of same size to same array
    :param graphs: numpy array of shape (num_of_graphs) of numpy arrays of graphs adjacency matrix
    :param labels: numpy array of labels
    :return: two numpy arrays. graphs arrays in the shape (num of different size graphs) where each entry is a numpy array
            in the shape (number of graphs with this size, num vertex, num. vertex, num vertex labels)
            the second arrayy is labels with correspons shape
    """
two numpy arrays. graphs arrays in the shape (num of different size graphs) where each entry is a numpy array
in the shape (number of graphs with this size, num vertex, num. vertex, num vertex labels)
the second arrayy is labels with correspons shape
two numpy arrays . graphs arrays in the shape ( num of different size graphs ) where each entry is a numpy array in the shape ( number of graphs with this size num vertex num . vertex num vertex labels ) the second arrayy is labels with correspons shape
graphs
numpy array of shape (num_of_graphs) of numpy arrays of graphs adjacency matrix
numpy array of shape ( num_of_graphs ) of numpy arrays of graphs adjacency matrix
labels
numpy array of labels
numpy array of labels