Answer the question
In order to leave comments, you need to log in
How to organize the algorithm of barter chains?
We are working on a service that allows you to exchange goods and services. Already several tens of thousands of registered users. who created profiles( City, Specialization, Information about myself), indicated their capabilities( I can ... , Description, Category( chose from the list), created deals( I need ... , Description, Category, Me on ... (indicated the possibilities))
How can barter chains be built on the basis of this?For example, in order for 3-5 users to participate in barter.Are there any thoughts on algorithms?
Answer the question
In order to leave comments, you need to log in
Your data structure is called a directed graph. The vertices of the graph are contractors. Directed edges - situations when counterparty A offers a product that counterparty B wants to purchase (a query for selecting such situations is written in SQL elementary and is processed almost instantly if the correct indexes are available).
You have two tasks:
"I can..." is the result
. "I need to..." is a requirement.
Make a selection of "result" - "requirement", where it is described by a specific word.
Example:
butter - milk
milk - hay
hay - diesel
fuel Run through the selection a couple of times, here are the chains.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question