GithubHelp home page GithubHelp logo

thefalco / progettoapi_2019_falconi Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 53 KB

Repo for my API's Project: a social network simulator

C 100.00%
simulation entity c tree-structure social-network hash hashing university-project politecnico-di-milano

progettoapi_2019_falconi's Introduction

Social Network simulator

This project has been developed as part of the "Algoritmi e Principi dell'Informatica" course at Politecnico di Milano.

A C program that monitor relations between elements.

Input Format

The program expects its input from stdio with the following format.

NOTE: Entities' and Relations' name cannot have whitespace characters in them.

Addition of an Entity

To add an Entity that will be monitored, it is needed to write it between quotation marks and after addrel keyword.

Addition of a Relation

This simulator allows entities to have monodirectional Relations. To add a Relation between two Elements, it is needed to use the following format:

addrel "<giver-entity>" "<receiver-entity>" "<relation-ID>"

The Relation will be created only if both Entities are being monitored.

Deletion of Relation

Similarly to the addition of a Relation, to delete a Relation it is needed to use the following format:

delrel "<giver-entity>" "<receiver-entity>" "<relation-ID>"

Deletion of an Entity

In order to stop monitoring an Entity and to delete all of its occurrences in the Relations that are being monitored, it is needed to write the name of the Entity between quotation marks and after delent keyword.

Creation of an Output

The report keyword will generate on stdout the list of the Relations that are being monitored, including for each Relation the entity/entities with the largest number of received relation, followed by the number of them; alphabetically ordered. The output follows this format:

"<relation-ID>" "<max-receiver-entity>" "<max-receiver-entity>" <max-number-of-givers>;

If no Relation is being monitored, the simulator will write in the stdout none.

End of the simulation

The end keyword will terminate the simulation.

Example of the input stream:

addent "Luke_Skywalker"
addent "Leia_Organa"
report
addrel "Leia_Organa" "Luke_Skywalker" "is_brother_of"
addrel "Darth_Vader" "Luke_Skywalker" "is_father_of"
report
addrel "Luke_Skywalker" "Leila_Organa" "is_loved_by"
report
delent "Luke_Skywalker"
report
end

Example of the output stream:

none
"is_brother_of" "Luke_Skywalker" 1;
"is_loved_by" "Leila_Organa" 1; "is_brother_of" "Luke_Skywalker" 1;
none

progettoapi_2019_falconi's People

Contributors

thefalco avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.