Sign in

There exist a spring night,

and a pleasant breeze,

such that, for all Scriabin’s preludes I am listening to,

I can sit down on the floor,

and dream

It’s April again.

Imbibe this magic potion!

The forest has held it for thousand years

Only for you, to discover

It is poison yet tonic

Long you stood, yet soon you took

Who are you, asked you

I am your lucid dream

2 concepts will be introduced: small-world network and scale-free network

Small-world network

Most nodes are not neighbors of one another, but the neighbors of any given node are likely to be neighbors of each other and most nodes can be reached from every other node by a small number of hops or steps.

There are several ways to determine if a network has the ‘small-world’ property. The simplest being:

L: The typical distance (shortest-length of the path) between 2 randomly chosen nodes in the network. In other words, you need to find the average shortest path length between all randomly chosen pairs…

Continuing from Part 1, where I showed how to build a network from scratch. I will explain 2 common network measures: centrality & assortativity. With python module networkx, they can be calculated easily. Consider our co-authorship network, namely, each node represents one author. Note that it is a complex network with many connected components and each component is an undirected multi-graph that contains multiple edges (self-loop, in this case, is not defined or does not exist in theory). There is an edge between 2 nodes if they collaborate in 1 publication.


‘What characterizes an important vertex?’

For our co-authorship network…

A fair coin is tossed. In the first round, you bet on 1$. If it turns out head, then you bet on 1$ for the next round, if it turns out tail, then next round you double your previous bet. In this way, if you have a successive loss, but after some time, you win the round, then you can get all your loss back, plus some little extra. Sounds good? I’ll simulate 10,000 rounds and show you why it’s a bad idea.

1 stands for win, -1 stands for loss

Imagine there is an urn with n white balls and m black balls. Every time, you draw a ball from the urn and put it back with k more balls of the same color. Repeat the process. The fraction of the white (black) balls in the urn is a martingale. (The expected color in the next draw is the same as the current expected color) Mathematical details coming soon...

It is unnecessary to create the initial urn with a random sampling method, but it’s a little fun thing to do anyway.

A girl wants to lose weight, but in the meantime, she does not want to be in lack of certain nutritions. Find her a minimum calorie diet that contains at least 800 mg of calcium, 55 grams of protein, and 200 grams of carbohydrates

In order to avoid monotony, she decides to eat at most 5 units of each food type. She likes eating yogurt with apples, so any time she eats a yogurt, she eats an apple with it. …

There are plenty of resources on the internet about the definitions of social network. Always feel free to check them out before reading this:)

My ‘definition’: A social network is like a giant graph, each node represents a unique entity, there’s 1 edge between 2 nodes if there’s 1 connection (e.g. 1 collaboration) between them. And it is very important to consider self-loop and multiple edges.

I have to mention co-authorship analysis again. Now, imagine, there is a scientific publication, there are several authors writing it together, the authors may come from the same institution (maybe from different departments), or…


A type of product is manufactured by refining raw oils and blending them together. The raw oils are of two categories:

Vegetable oils: VEG 1 VEG 2

Non-vegetable oils: OIL 1 OIL 2 OIL 3

Each oil may be purchased for immediate delivery (January) or bought on the futures market for delivery in a subsequent month. Prices at present and in the futures market are given below in (£/ton):

The final product sells at £150 per ton.

Vegetable oils and non-vegetable oils require different production lines for refining. In any month, it is not possible to refine more than 200…


A generic medicine producer has three products: P, K, and R. One production unit is a big box containing 1000 small boxes. The demand forecasts for the next five weeks are the following:

The capacity requirements of the products are equal and the production of one production unit lasts 1 time unit. The weekly capacity of the company is 5000 time units. The set-up costs and the inventory holding unit costs (being in stock for one week) are the following: AP=$230, AK=$150, AR=$320, hP=$4, hK=$3, hR=$6. Determine the minimal cost production schedule.


Variables: x_ij: the amount we produce for product…


I am self-exploring machine learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store