Python utils.read_graph() Examples

The following are 6 code examples of utils.read_graph(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module utils , or try the search function .
Example #1
Source File: main.py    From SGCN with GNU General Public License v3.0 6 votes vote down vote up
def main():
    """
    Parsing command line parameters.
    Creating target matrix.
    Fitting an SGCN.
    Predicting edge signs and saving the embedding.
    """
    args = parameter_parser()
    tab_printer(args)
    edges = read_graph(args)
    trainer = SignedGCNTrainer(args, edges)
    trainer.setup_dataset()
    trainer.create_and_train_model()
    if args.test_size > 0:
        trainer.save_model()
        score_printer(trainer.logs)
        save_logs(args, trainer.logs) 
Example #2
Source File: main.py    From GraRep with GNU General Public License v3.0 5 votes vote down vote up
def learn_model(args):
    """
    Method to create adjacency matrix powers, read features, and learn embedding.
    :param args: Arguments object.
    """
    A = read_graph(args.edge_path)
    model = GraRep(A, args)
    model.optimize()
    model.save_embedding() 
Example #3
Source File: main.py    From BANE with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command lines, creating target matrix, fitting BANE and saving the embedding.
    """
    args = parameter_parser()
    tab_printer(args)
    P = read_graph(args)
    X = read_features(args)
    model = BANE(args, P, X)
    model.fit()
    model.save_embedding() 
Example #4
Source File: attentionwalk.py    From AttentionWalk with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, args):
        """
        Initializing the training object.
        :param args: Arguments object.
        """
        self.args = args
        self.graph = read_graph(self.args.edge_path)
        self.initialize_model_and_features() 
Example #5
Source File: main.py    From DANMF with GNU General Public License v3.0 5 votes vote down vote up
def main():
    """
    Parsing command lines, creating target matrix, fitting DANMF and saving the embedding.
    """
    args = parameter_parser()
    tab_printer(args)
    graph = read_graph(args)
    model = DANMF(graph, args)
    model.pre_training()
    model.training()
    if args.calculate_loss:
        loss_printer(model.loss) 
Example #6
Source File: sine.py    From SINE with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, args):
        """
        Initializing the training object.
        :param args: Arguments parsed from command line.
        """
        self.args = args
        self.graph = read_graph(self.args.edge_path)
        self.features = read_features(self.args.feature_path)
        self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
        self.initialize_model()
        self.simulate_walks()